为什么文本格式不可读。

编程入门 行业动态 更新时间:2024-10-25 13:21:34
本文介绍了为什么文本格式不可读。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

大家好, 我是Linux编程新手,编写了一个文件编写程序,文件已创建,但文件文件不是可读格式,任何人都可以说出原因吗? 这是程序

Hi All, I am new to Linux programming, wrote an file writing program,the file is created but the text is file is not in readable format can anyone tell why? Here is the program

#include <stdio.h> #include <stdlib.h> #include <fcntl.h> #include <errno.h> #include <sys/types.h> #include <unistd.h> #define BUF_SIZE int main() { int fd; char* buffer = "hi"; fd = open("/home/abc/Desktop/log.txt", O_WRONLY | O_CREAT | O_APPEND,777); ssize_t out = write (fd,;this is me",12); printf("value of out is %d",out); close(fd); }

推荐答案

可能是因为你的程序没有编译,因此也没有生成EXE文件。所以你正在运行什么来创建文件,我不知道... 尝试更改: Probably, because your program doesn't compile, and thus doesn't produce an EXE file. So exactly what you are running to create the file, I don't know... Try changing: ssize_t out = write (fd,;this is me",12);

To

ssize_t out = write (fd,"this is me",12);

它可能无效 - 我还没有测试过 - 但至少它会编译并产生一个EXE文件...

It may not work - I haven't tested it - but at least it will compile and produce an EXE file...

更多推荐

为什么文本格式不可读。

本文发布于:2023-11-11 06:30:08,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1577633.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:可读   文本   格式

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!