This is an incomplete program, but what I have now is main calling openFiles, which is supposed to check if this file is successfully opened for writing and reading. I'm getting these errors which I haven't figured out:
18: warning: passing arg 1 of `openFiles' from incompatible pointer type
18: warning: passing arg 2 of `openFiles' from incompatible pointer type
In function `openFiles':
35: error: syntax error before ')' token
Code:#include <stdio.h> #include <stdlib.h> #include <time.h> #include <stdbool.h> bool openFiles(FILE **pFPIn, FILE **pFPOut, int* input1, int* input2); int main(void) { FILE *fpIn, *fpOut; int input1, input2; openFiles(fpIn, fpOut, &input1, &input2); //line 18 generate(input1, input2); return 0; } bool openFiles(FILE **pFPIn, FILE **pFPOut, int* input1, int* input2) { FILE *fpIn, *fpOut; bool success = false; if ((fpIn = fopen("test.txt", "r")) != NULL) { if ((fpOut = fopen("test.out", "w")) != NULL) { fscanf(fpIn, "%d%d", &input1, &input2) == 2) //line 35 fclose(fpOut); success = true; } else printf("\nUnable to open \"test.out\" for writing.\n\n"); fclose(fpIn); } else printf("\nUnable to open \"test.txt\" for reading.\n\n"); return success; }
I also plan to pseudo randomly generate numbers into a text file. How would I get these numbers to correspond to ASCII characters when they are put into the text file?
Thanks.



LinkBack URL
About LinkBacks



