New code below
Code:
#include <stdio.h>
#include <string.h>
int main(int argc, char *argv[])
{
FILE *output;
char line[256];
int x;
FILE * input = NULL;
output = fopen("output.txt", "w");
if((input = fopen(argv[1], "r")) != NULL )
{
while(fgets(line, 256, input) != NULL)
{
char *x = strchr(line, '{');
if(x)
{
fprintf("output.txt","%c", '/n');
}
fprintf(output, "%s", line);
}
}
fclose(input);
fclose(output);
}
Getting the following compile error
exL2.c:18:32: warning: multi-character character constant
exL2.c:18:5: warning: passing argument 1 of ‘fprintf’ from incompatible pointer type /usr/include/stdio.h:335:12: note: expected ‘struct FILE * __restrict__’ but argument is of type ‘char *’
Not sure why this is happening, any thoughts anyone?