Hi there,
I have to read in a file line by line, and then write into another file. Since I do not know how many characters in one line, I can not define a char array with fixed size. so what shall I do then?
I did sth like
char *line;
char ch;
//read the line char by char
for (j = 0; ((ch = getc(out)) != EOF) && (ch != '\n'); j++)
line[j] = ch;
but when I run it , it always shows up "ACCESS VIOLATION". Please help
I have to read in a file line by line, and then write into another file. Since I do not know how many characters in one line, I can not define a char array with fixed size. so what shall I do then?
I did sth like
char *line;
char ch;
//read the line char by char
for (j = 0; ((ch = getc(out)) != EOF) && (ch != '\n'); j++)
line[j] = ch;
but when I run it , it always shows up "ACCESS VIOLATION". Please help