Sign in to follow this  

saving a array

This topic is 4836 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

this is the code i used and i need some how to save this out to a binary file format.

write error code


int Write_Error(char *string, ...)


{
// this function prints out the error string to the error file

char buffer[80]; // working buffer

va_list arglist; // variable argument list

// make sure both the error file and string are valid
if (!string || !fp_error)
return(0);

// print out the string using the variable number of arguments on stack
va_start(arglist,string);
vsprintf(buffer,string,arglist);
va_end(arglist);

// write string to file
fprintf(fp_error,buffer);

// return success
return(1);
} // end Write_Error






// code to save it to txt file


Open_Error_File("Array.txt");

for (int Map0=0;Map0<200;Map0++)

{
Write_Error("\n ");




for (int Map1=0;Map1<10 ;Map1++)

{
int array = Map_Array[Map0][Map1];
sprintf(buffer,"test = [%d] ", array);
Write_Error("(%d ):",array);



}


}


Close_Error_File();

Share this post


Link to post
Share on other sites

This topic is 4836 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this