Page 1 of 1

writing files!

PostPosted: Jun 11, 2002 @ 4:30am
by brendan
Hi All, I'm trying to create a level editor for my new game, I can "edit" the levels etc, but not save the info in the format I require. I have a d-array [20][20] and would like the output to be easy to place into the game code....

anyhow, does anyone have any ideas how to do this? some sample code would be good....

data is in the following format

int level_data[20][20];

required file contents after editor output: (std text)

{
{3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,4},
{2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2},
{2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2},
{2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2},
{2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2},
{2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2},
{2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2},
{2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2},
{2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2},
{2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2},
{2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2},
{2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2},
{2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2},
{2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2},
{2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2},
{2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2},
{2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2},
{2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2},
{2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2},
{6,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,5}
};
etc....

help, please.... I looked at the file handling funcs, and it looks hell messy....

-thanks, Brendan

PostPosted: Jun 11, 2002 @ 4:40am
by R0B

PostPosted: Jun 11, 2002 @ 5:11am
by brendan

PostPosted: Jun 11, 2002 @ 5:23am
by Dan East

PostPosted: Jun 11, 2002 @ 6:28am
by brendan

PostPosted: Jun 11, 2002 @ 4:21pm
by R0B