怎么创建有大小的空文件?我用下面的 不行呀.FILE* f fopen(d:/d.txt,ab)if (f){int iret fseek(f
怎么创建有大小的空文件? 我用下面的 不行呀.
FILE* f = fopen("d:/d.txt","ab"); if (f) { int iret = fseek(f,1024 * 1024 * 1024 - 1,SEEK_SET); fwrite("",1,1,f); fclose(f); }
[解决办法]
msdn: When a file is opened with the "a" or "a+" access type, all write operations occur at the end of the file. The file pointer can be repositioned using fseek or rewind, but is always moved back to the end of the file before any write operation is carried out.