Code Snippets C

//Header file: #include
//Declaration: size_t fwrite(const void *buf, size_t size, size_t count, FILE *stream);
//Return: returns the number of items written on success. Fewer items written means failure.
#include
#include
int main(void)
{
FILE *filep;
float f=13.23;
if((filep=fopen("test", "wb"))==NULL) {
printf("Cannot open file.\n");
exit(1);
}
fwrite(&f, sizeof(float), 1, filep);
fclose(filep);
return 0;
}