Advertisement
Khenzashi

Escrever em arquivo

Jan 31st, 2015
290
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.32 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4.  
  5. int main(){
  6.  
  7.  FILE *saida;//ponteiro para o arquivo log.txt
  8.  saida = fopen("log.txt","w");
  9.  
  10. char nome[30];
  11. char sobrenome[30];
  12. scanf("%s", nome);
  13. scanf("%s", sobrenome);
  14.  
  15. fprintf(saida,"Nome: %s Sobrenome: %s\n\n", nome,sobrenome);
  16.  
  17. close(saida);
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement