1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
| SUB MAIN()
DIM intResult as integer;
DIM intEOF as integer;
DIM StrAccess as Str;
DIM StrFilename as Str;
DIM StrLine as Str;
DIM str1 as Str;
DIM nbr as integer;
DIM sortir as integer;
DIM Intval as integer;
StrFilename = "test.txt"; 'nom du fichier a ouvrir
'For a full path put "\\" instead of "\" => "C:\\SV\\test.txt" '
StrAccess = "r"; 'ouvre en mode lecture
' ouvre le fichier
intResult = FOPEN(StrFilename , StrAccess);
IF (intResult ==1) THEN
PRINT("Opening of file ", StrFilename," succeeded");
END IF
'boucle permettant de lire les caractères 1 à 1
WHILE(sortir!=1)
str1 = FGETC ("test.txt");
IF(1 == IntVal = CMPSTRING(str1, ",")) THEN
sortir=1;
ELSE
nbr=nbr+1;
PRINT(Str1);
END IF
WEND
'fermeture du fichier
intResult = FCLOSE(StrFilename);
IF (intResult ==1) THEN
PRINT("Closure of file ", StrFilename," succeeded");
END IF
END SUB |
Partager