Staredit Network > Forums > Technology & Computers > Topic: C++ File Output
C++ File Output
Jan 18 2009, 9:19 pm
By: Elvang  

Jan 18 2009, 9:19 pm Elvang Post #1



I'm currently using C++ and ShadowFlare's mpq library to mess around with maps. My program currently opens the mpq, opens the chk, then writes each section to a temp file(after any editing) before finally adding it back to the mpq and compacting it.

I'm using write() with a fstream(app|out|binary) and it will output some sections correctly but others it will screw up the data (after investigation of temp file with hex editor). The documentation for fstream::write() says the output is unformatted even though it takes a char*, and I'm sending it a pointer to the buffer for each section; in the case of edited sections I send it a pointer to a structure. The temp file size is correct, though some of the data is incorrect. Scmdraft also seems to think that the resulting mpq has been protected(with and without file compression). Any hints as to what I'm doing wrong? Been messing with it on and off for a few days and I'm out of ideas.

I can attach the .cpp if needed, only ~150 lines with comments.



None.

Jan 19 2009, 4:34 am Falkoner Post #2



SCM Draft is extremely sensitive to protection, so if anything is out of the ordinary, it stops trying to read it, even though it could easily fix the problem.



None.

Jan 19 2009, 4:47 am Elvang Post #3



Staredit also refuses to open it :\



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[04:15 am]
DarkenedFantasies -- you eat lots of beans
[03:46 am]
IskatuMesk -- how do i get gas
[11:43 pm]
Moose -- you don't
[10:06 pm]
Zoan -- how do i get minerals
[2026-4-14. : 11:45 pm]
ClansAreForGays -- Anyone wanna played Skewed StarCraft?
[2026-4-14. : 12:07 am]
Vrael -- NudeRaider
NudeRaider shouted: Vrael ranting still is though
you're a gentleman and a scholar, thank you
[2026-4-13. : 10:07 pm]
NudeRaider -- ya why phone people when you can just write letters
[2026-4-13. : 9:37 pm]
IskatuMesk -- I have never and will never own a phone
[2026-4-13. : 9:15 pm]
NudeRaider -- Vrael ranting still is though
[2026-4-13. : 9:14 pm]
ClansAreForGays -- anticapitalism isnt edgy anymore
Please log in to shout.


Members Online: Ultraviolet