Convert Minecraft server world files into MCserver world files.
#38
Thanks for the info, I must have spent 4 hours trying to get that to work.

You can see this is commented out because it didn't work:
//if( fread( comp_data, compdlength, sizeof(unsigned char), f) != 1 ) { cout << "ERROR 1234 READING FROM FILE " << SourceFile <<endl; fclose(f); return false; } //actual compressed chunk data


and variations I tried:

fread( comp_data, sizeof(unsigned char), compdlength, f)
fread( comp_data, compdlength, sizeof(unsigned char), f)
fread( &comp_data, sizeof(unsigned char), compdlength, f)
fread( &comp_data, compdlength, sizeof(unsigned char), f)
fread( *comp_data, sizeof(unsigned char), compdlength, f)
fread( *comp_data, compdlength, sizeof(unsigned char), f)
fread( comp_data, 1, compdlength, f)
fread( comp_data, compdlength, 1, f)
fread( &comp_data, 1, compdlength, f)
fread( &comp_data, compdlength, 1, f)
fread( *comp_data, s1, compdlength, f)
fread( *comp_data, compdlength, 1, f)

I also tried hard coding different value for compdlength. The only way I could get it to work was byte by byte. It was a nightmare and I don't understand why it wouldn't work. I tried unsigned char, signed car, strings, etc.

I kept getting segmentation errors, ERROR 1234 READING FROM FILE, or sometimes it would would just do nothing. I have no clue why I couldn't get it to work. The way I originally had it looked like what you had.


I have NO clue why it wasn't working before, but I just changed it to this and now it's working just fine. IT must have been something else in the code causing the problem. Sad (It was also sometime between 1:00 AM and 5:00 AM that I was working on it.)

Code:
char temparr[compdlength]; //can't get fread to read more than one char at a time into a char array... so that's what I'll do.  :(    At least it works.
                                if( fread( temparr, compdlength, 1, f) != 1 ) { cout << "ERROR rf22 READING FROM FILE " << SourceFile; fclose(f); return false; }
                                frloc = frloc + compdlength;


ehh, same sort of problems I faced while learning PHP. You spend hours beating your head against the table and pulling out your hair until you find the moment of retardation you placed into the code.
Reply
Thanks given by:


Messages In This Thread
RE: Convert Minecraft server world files into MCserver world files. - by rs2k - 10-30-2011, 10:32 AM



Users browsing this thread: 1 Guest(s)