All pastes #18486 Raw Edit

Untitled

public text v1 · immutable
#18486 ·published 2005-07-25 20:16 UTC
rendered paste body
// mywrite.cpp Adam Goff 7/25/2005
#include <stdio.h>

#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.");
	}
   }
}