24 lines
507 B
C
24 lines
507 B
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
/*fseek(<fichier>, <déplacement>, <origine>) : déplace curseur
|
|
-> <origine> : SEEK_SET (début du fichier)
|
|
SEEK_CUR (position courante)
|
|
SEEK_END (fin du fichier)
|
|
*/
|
|
int main(void){
|
|
FILE *fic = fopen("text.txt", "r");
|
|
|
|
if(fic==NULL)
|
|
{exit(1);}
|
|
|
|
printf("Position : %d\n", ftell(fic));
|
|
|
|
fseek(fic,5,SEEK_SET);
|
|
|
|
printf("Position : %d\n", ftell(fic));
|
|
|
|
|
|
fclose(fic);
|
|
|
|
} |