[ create a new paste ] login | about

Link: http://codepad.org/vatmcleX    [ raw code | output | fork ]

C, pasted on Dec 12:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <stdio.h>
#define FILENAME "test.txt"
#define N 20
int main()
{
  FILE *fp;
  char buffer[N];
  fp = fopen(FILENAME, "r");
  if (fp == NULL) {
    fprintf(stderr, "cannot open the file %s.", FILENAME);
    return -1;
  }
  fgets(buffer, N, fp);
  printf("%s", buffer);
  fclose(fp);
  return 0;
}
/* end */


Output:
1
2
cannot open the file test.txt.
Exited: ExitFailure 255


Create a new paste based on this one


Comments: