I need take every new line and print that.
What can I do with it?
char *str;
int q;
while(!feof(file)){
q = getc(file);
if(q == '\n'){
str=(char*)malloc(100);
*str=(char)q;
printf("%s\n", str); // <- mistake, that printed only parts with '\n'
free(str);
}
printf("%q",q); // <- worked
printf("%s",q); // <- mistake
}
How to transfer value to string and print that string-by-string.
p.s. No told me about use stream and other methods. And help me in that in C, no C++.
_____
Thank in adv.