Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- file integer value read to write
- #include<stdio.h>
- #include<stdlib.h>
- int main()
- { int i;
- FILE *fp;
- fp=fopen("D:\\Filepblm3.txt","w");
- for(i=1;i<=5;i++)
- {
- fprintf(fp,"%d\n",i);
- }
- fclose(fp);
- return 0;
- }
- ..,,,,,.,,,,,,,,,,,,,,,,,,
- #include<stdio.h>
- #include<stdlib.h>
- int main()
- {
- FILE *fp;
- fp=fopen("D:\\Filepblm3.txt","r");
- int i,num;
- // char string[100];
- //while(fscanf(fp,"%s",string)!=EOF)
- // {
- for(i=1;i<=5;i++)
- {
- fscanf(fp,"%d",&num);
- printf("%d\n",num*num);
- }
- //fclose(fp);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement