C--文件操作

来源:互联网 发布:大鱼海棠正版周边淘宝 编辑:程序博客网 时间:2024/05/17 03:09
_lseek

<io.h>,_lseek returns the offset, in bytes, of the new position from the beginning of the file. _lseeki64 returns the offset in a 64-bit integer.

例:

 /* Find current position: */   pos = _lseek( fh, 0L, SEEK_CUR );   if( pos == -1L )      perror( "_lseek to current position failed" );   else      printf( "Position for current position seek = %ld\n", pos );


 fwrite ,wrtie,writefile的关系

FwriteC库函数,writeLinux系统API函数,writefilewindows系统API函数。


宽字节

保存到文件

fwprintf(fp,L"%d\r\n",100);