Advertisement
Jambix64

CriandoArquvos/C

Aug 7th, 2016
1,198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <stdlib.h>
  3. #include <stdio.h>
  4. #include <fstream>
  5.  
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10.  
  11.    FILE *file1;
  12. // Primeiro parametro duas barras e uma barra!  //Segundo parametro Ler são seis letras
  13.    file1 = fopen("file.txt","w");//Se o diretourio ser protegido pode nao criar;
  14.  
  15.    fprintf(file1,"GameOver");
  16.    fclose(file1);//Para fechar o ocorrido acima;
  17.  
  18.    // Lendo um arquivo em C
  19.    FILE *file2;
  20.    int y;
  21.    file2 = fopen("file.txt","r");
  22.    fscanf(file2,"%i",&y);
  23.    printf("%i",y);
  24.  
  25.     return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement