Share Pastebin
Guest
Public paste!

Untitled

By: a guest | Sep 5th, 2010 | Syntax: C++ | Size: 0.34 KB | Hits: 27 | Expires: Never
Copy text to clipboard
  1. FILE * pfile = fopen("mitextfile.txt", "r");
  2. int a;
  3. // read one integer from the file
  4. fscanf(pfile, "%d", %a);
  5. // read one string from the integer
  6. char buff[90];
  7. fscanf(pfile, "%s", buff);
  8. fclose(pfile);
  9.  
  10. FILE * outfile = fopen("othertextfile.txt", "w");
  11. fprintf(outfile, "%s", "hola mundo");
  12. fpritinf(outfile, "the value of a is %d", a);