This is my code and apparently it won't take the quotation marks even if I put a \ in front of it!
Code:
#include <stdio.h>
#include <string.h>
int main(){
FILE* file;
FILE* output;
int i = 0;
char string[500];
if(((file = fopen("try.txt", "r")) != NULL) && ((output = fopen("random.txt", "w")) != NULL)) {
while(fgets(string, 499, file) != NULL) {
string[(strlen(string) - 2)] = '\0';
fprintf(output, " histsArrayGood[h%s] = new TH1F( \"g_h%s\", \"Actual %s\", Nb_Blocks[%i], X_Min, X_Max);\n", string, string, i, string);
fprintf(output, " histsArrayGood[h%s] = new TH1F( \"g_h%s\", \"Actual %s\", Nb_Blocks[%i], X_Min, X_Max);\n", string, string, i, string);
i++;
}
}
fclose(file);
fclose(output);
return(0);
}
Here's the error message:
Code:
faster.c: In function 'main':
faster.c:17: warning: format '%s' expects type 'char *', but argument 5 has type 'int'
faster.c:17: warning: format '%i' expects type 'int', but argument 6 has type 'char *'
faster.c:18: warning: format '%s' expects type 'char *', but argument 5 has type 'int'
faster.c:18: warning: format '%i' expects type 'int', but argument 6 has type 'char *'
I'm running gcc 4.1.2 (Gentoo 4.1.2 p1.0.2)...
I'm just tired of trying to look around for the answer. Thanks for helping guys!