DreamScape DST File Format



Here is an example how to load a .dst file format:


FILE *in=fopen(fname,"rb");


char chbuff[256]={'\0'};


//load file ID. Should be "DreamScape"

fscanf(in,"%s ",chbuff);


if(strcmp(chbuff,_T("DreamScape"))!=0){ MessageBox(hWnd,_T("Not a valid DreamScape Terrain"),_T("DreamScape Terrain"),MB_ICONSTOP | MB_OK);


goto tryAgain; }


//load file version

fscanf(in,"%s ",chbuff);


int hsize=0;


//load grid size. Actual dimensions are hsize*hsize

fscanf(in,"%d |",&hsize);


//load data - row by row

for(int h=0;h< hsize;h++) fread( data[h],sizeof(WORD), hsize,in);