古詩詞大全網 - 古詩大全 - fseek中偏移量為什麽要加壹個L

fseek中偏移量為什麽要加壹個L

fseek 函數原型是:

int fseek ( FILE * stream, long int offset, int origin );

參數2 是偏移量, long int 型。

偏移量 為變量名字時,不需要加 壹個L,

整常數,可以加 L,表示 long int 型。

其實,不加L,壹般編譯器也都知道是 long 型。

fseek ( pFile , 9L , SEEK_SET ); 和

fseek ( pFile , 9 , SEEK_SET ); 效果壹樣。