Advertisement
Guest User

Untitled

a guest
Mar 30th, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.67 KB | None | 0 0
  1. // creare si consultarepentru un fisier text care memoreaza elemente intregi
  2. /*  La crearea fişierului, fişier conducător este fişierul standard de intrare. 
  3. La afişare, conducător este fişierul f.  */
  4.  
  5.  
  6.    #include<stdio.h>
  7.    #include<conio.h>
  8.    #include<stdlib.h>
  9.  
  10. void main()
  11. {
  12.     int x;
  13.     FILE* f;
  14.     char* nume;
  15.     long dim;
  16.     f=fopen("nume.txt","w+");
  17.     scanf("%d",&x);
  18.     if(!feof(stdin))
  19.     {
  20.         fprintf(f,"%d",x);
  21.         scanf("%d",&x);
  22.     }
  23.     fseek(f,0,SEEK_SET);
  24.     fscanf(f,"%d",&x);
  25.     while(!feof(f))
  26.     {
  27.         printf("%d",x);
  28.         fscanf(f,"%d",&x);
  29.     }
  30.     fclose(f);
  31.     getch();
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement