int f = open("/tmp/vars.txt", O_RDWR | O_CREAT, S_IRUSR | S_IRGRP | S_IROTH);
if (f == NULL)
{
printf("Error opening file!\n");
exit(1);
}
write(f, string_array, 100); //doesnt work
我也试过
FILE *f = fopen(vars.txt, "wb") //and 'w"
fprintf(f, "array = %s ", string_array);
没有打印任何东西
我很久没有使用过C了。任何人都可以帮忙。
即使我仅使用文字string_array
替换write(f, "test", 10)
..它也不会向文件写入任何内容。
已解决我遇到缓冲区问题..我修复了它。