Created
April 12, 2012 20:07
-
-
Save taq/2370628 to your computer and use it in GitHub Desktop.
Escrevendo no arquivo, em C
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main(int argc, char **argv) { | |
int i = 123; | |
double d = 456789; | |
FILE *file; | |
file = fopen("teste.bin","wb"); | |
printf("gravando int com %d bytes\n",sizeof(int)); | |
fwrite(&i,sizeof(int),1,file); | |
printf("gravando double com %d bytes\n",sizeof(double)); | |
fwrite(&d,sizeof(double),1,file); | |
fclose(file); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment