// mywrite.cpp Adam Goff 7/25/2005 #include #define DATA_SIZE=32; int main() { // declarations FILE *mywrite; int status; int data; float buff[10] = { 31.56 16.2 7890.2 -100.1356 45.0 561.792 -2.0 17.5 243.63 -243.63 }; // open file mywrite = fopen("mydata.dat", "wb"); if(mywrite == NULL) { printf("File could not be opened/created"); } else { data = fwrite(buff,1, DATA_SIZE,mywrite); if(data != DATA_SIZE) { printf("Not all of your data was written"); } //close the file now.. status = fclose(mywrite); if(status != 0) { printf("File not successfully closed."); } } }