Bye Bye Moore

PoCソルジャーな零細事業主が作業メモを残すブログ

2018-10-23から1日間の記事一覧

write関数で所定の長さのデータを書き込む

C

エラー対策もブン投げた最小構成は以下のような感じ。 ただし、ファイルはちゃんと閉じましょう。 #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> int main(void) { int fd; char buf[256] = "1,2,3\n4,5,6\n7,8,9\n"; ssize_t ret; fd = open("./data.log", O_CR</unistd.h></fcntl.h></sys/stat.h></sys/types.h>…