Skip to content

Instantly share code, notes, and snippets.

@taq
Created April 12, 2012 20:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save taq/2370628 to your computer and use it in GitHub Desktop.
Save taq/2370628 to your computer and use it in GitHub Desktop.
Escrevendo no arquivo, em C
#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