This shows you the differences between two versions of the page.
programare-cc:laboratoare:11 [2023/12/20 13:50] mihai.nan [Problema 3B] |
programare-cc:laboratoare:11 [2023/12/20 14:41] (current) mihai.nan [Problema 1 (Rezolvata)] |
||
---|---|---|---|
Line 61: | Line 61: | ||
| | ||
pFile = fopen("myfile.txt" , "r"); | pFile = fopen("myfile.txt" , "r"); | ||
- | if (pFile == NULL) | + | if (pFile == NULL) { |
printf("Nu s-a putut deschide fisierul"); | printf("Nu s-a putut deschide fisierul"); | ||
+ | return 1; | ||
+ | } | ||
| | ||
while (fgets(buffer, BUFMAX, pFile) != NULL) { | while (fgets(buffer, BUFMAX, pFile) != NULL) { | ||
Line 68: | Line 70: | ||
} | } | ||
fclose(pFile); | fclose(pFile); | ||
+ | return 0; | ||
} | } | ||
</code> | </code> | ||
Line 177: | Line 180: | ||
==Exemplu== | ==Exemplu== | ||
Aplicăm algoritmul de codare pe fişierul input.txt şi vom obţine un fişier output.txt. | Aplicăm algoritmul de codare pe fişierul input.txt şi vom obţine un fişier output.txt. | ||
- | ./executabil tabela_de_codare.in input.txt output.txt | + | |
+ | |||
+ | **./executabil tabela_de_codare.in input.txt output.txt** | ||
^ Intrare (input.txt ) ^ Ieşire (output.txt) ^ | ^ Intrare (input.txt ) ^ Ieşire (output.txt) ^ |