Jump to content
  • Advertisement
Sign in to follow this  
Lindon Heaven

saving a array

This topic is 5416 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

how do i save out a array in c the array is like theis Map_Array[200][10]; i can get it to print to a txt file but i want to be able to load and save it in a game. thanks

Share this post

Link to post
Share on other sites
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)

// print out the string using the variable number of arguments on stack

// write string to file

// return success
} // end Write_Error

// code to save it to txt file


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);




Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!