Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Read Binary File fread();
- #include<stdio.h>
- #include<conio.h>
- void main()
- {
- FILE *fp;
- char str[11];
- clrscr();
- fp = fopen("welcome.txt", "r+");
- if(fp==NULL)
- {
- printf("\n The file could not be opened");
- exit(1);
- }
- //fread();
- fread(str, 10, 1, fp);
- str[10]= '\0';
- printf("\n First 10 characters of the file are : %s", str);
- fclose(fp);
- getch();
- }
Add Comment
Please, Sign In to add comment