Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // just another example by Cooler_
- #include <errno.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- FILE *
- open_sesame (char *name)
- {
- FILE *stream=NULL;
- errno = 0;
- stream = fopen (name, "rx");
- if (stream == NULL)
- {
- fprintf (stderr, " File:%s \n %s\n", name, strerror (errno));
- exit (1);
- }
- else
- return stream;
- }
- int main()
- {
- FILE *startrek=open_sesame("mano_jones_.txt");
- // ... etc
- exit(0);
- }
Advertisement
Add Comment
Please, Sign In to add comment