Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Part of a program that read a file. */
- #include <stdio.h>
- #include <stdlib.h>
- int main() {
- FILE *mainfile;
- mainfile = fopen("texto.txt", "r+");
- if (mainfile == NULL) { printf("ERROR"); }
- else { printf("OK"); }
- unsigned char string[100][10001]; // [line break][letters]
- int qnt; // amount of line break
- int f, f2; // any use (for)
- for (qnt = 0; qnt < 100; qnt++) {
- printf("\n=== Point ==="); // the error happens after "=== point ==="
- fgets(mainfile, 9999, string[qnt]);
- /*
- The compiler compiles, but also presents these two errors:
- [Warning] passing arg 1 of `fgets' from incompatible pointer type
- [Warning] passing arg 3 of `fgets' from incompatible pointer type
- */
- for (f = 0; f < 9999; f++) {
- printf("\n> %d", f);
- if (string[qnt][f] == 255) { goto goto_EOF; }
- if (string[qnt][f] == '\0') { break; }
- }
- }
- goto_EOF:
- (...) }
- RUN:
- >>> OK.
- >>> === Point ===
- The program crashes <<<
- :END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement