Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- READ MODE
- #include<stdio.h>
- #include<stdlib.h>
- int main()
- {
- int i;
- FILE *fp;
- fp=fopen("D:\\newfile.txt","w");
- // fputs("123456",fp);
- for(i=1;i<=10;i++)
- {
- fprintf(fp,"%d\n",i);
- }
- fclose(fp);
- }
- WRITE MODE
- #include<stdio.h>
- #include<stdlib.h>
- int main()
- {
- FILE *fp;
- fp=fopen("D:\\newfile.txt","r");
- int i,num;
- char c[100];
- for(i=1; i<=10; i++)
- {
- fscanf(fp,"%d\n",&num);
- printf("%d\n",num*num);
- }
- fclose(fp);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement