Advertisement
Gallefray

Doesn't look like it should segfault right?

Mar 28th, 2014
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.24 KB | None | 0 0
  1. int readf()
  2. {
  3.     char ch[3];
  4.     ch[1] = '\0';
  5.     FILE *input = fopen(infile, "r");
  6.     while ((ch[0] = getc(input)) != '\n' && ch[0] != '\\' && ch[0] != EOF)
  7.     {
  8.         strcat(lbuf, ch);
  9.         printf("char: %s\n", ch);
  10.     }
  11.     printf("%s", lbuf);
  12.     return 0;
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement