Advertisement
tutorfree

ED - grava frase no arquivo de texto

Jun 29th, 2016
410
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.47 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. #ifdef WIN32
  5.     #include <conio.h>
  6.     #define LIMPA_TELA system("cls")
  7. #else
  8.     #include <ncurses.h>
  9.     #define LIMPA_TELA system("clear")
  10. #endif
  11.  
  12. int main()
  13. {
  14.     int i;
  15.     char frase[]="Sistema Operacional GNU/Linux";
  16.     FILE *fp = fopen("saida.txt","wt");
  17.  
  18.     for(i=0; frase[i]!='\0';i++)
  19.         fprintf(fp,"%c",frase[i]);
  20.     fclose(fp);
  21.     printf("arquivo gravado\n");
  22.  
  23.     system("pause");
  24.     return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement