Advertisement
Guest User

tel_num.c

a guest
Sep 12th, 2011
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.54 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4.  
  5. #define CLEAR(x) memset(x, '\0', 512)
  6. #define FILENAME "num.txt"
  7.  
  8. int main()
  9. {
  10.   FILE *fp;
  11.   long int num = 3334590234L;
  12.   long int num1 = 0L;
  13.  
  14.  
  15.   if ( ( fp = fopen(FILENAME, "w+") ) == NULL )
  16.     {
  17.       perror("ERROR in reading file!\n");
  18.       exit(-1);
  19.     }
  20.   else
  21.     fprintf(fp,"%ld", num);
  22.  
  23.   fseek(fp, 0, SEEK_SET);
  24.  
  25.   fscanf(fp, "%ld",&num1);
  26.  
  27.  
  28.   printf("ORIGINAL TELEPHON NUMBER : %ld\n", num);
  29.   printf("READ TELEPHON NUMBER : %ld\n", num1);
  30.  
  31.   return EXIT_SUCCESS;
  32.  
  33.  
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement