Not logged in, Join Here! or Log In Below:  
News Articles Search    

 Home / General Programming / There is a ghost in my computer.... help! Account Manager
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.

April 26, 2005, 02:45 PM

No of course there is no real ghost in my computer(actually you're never 100% sure are you?). But it sure looks like it.
I've made a program that loads textstrings from a file which are used as filenames. In my program I only open files for READING, not writing. What happened is:

file armortextures.txt:

this is a filename for an image to be loaded. The loader(which works) says it can not load:

somehow this seems to be incorrect. Probably because it IS incorrect, because it should have been the same filename text as above.

Now I fill in:
21 weird characters, represented bij an [] (a block character, i don't know which asc values) and now the loader says:
it can't load:

which is almost the filename I want. And no I didn't fill in those wierd values myself, it was suddenly there after I entered the string above(without the ofcourse). The weird characters have to be 16 bit character because the filename is 42 characters and there are only 21 (weird) characters visible.
I have another file, healthtextures.txt in which I do the same but there the string is:

and it works perfectly. And when I fill in this string in armortextures.txt it also works perfectly, except of course it loads the wrong image and not armor.img.

If you want the code, I can only email it or msn it (it's about 8mb with textures etc.).

Anyone knows what can be the problem?

PS. I used notepad to write the filename texts in armortextures.txt and healthtextures.txt


April 26, 2005, 03:16 PM

First thing that came to mind is wierd char. encoding, things that sould be ACSII are unicode, etc...

Try to recreate armortextures.txt

Nils Pipenbrinck

April 26, 2005, 04:18 PM

skeb wrote: this is a filename for an image to be loaded. The loader(which works) says it can not load:

is the start of a little endian unicode textfile.. 0xfe 0xff I think.

Either convert the file to ascii (notepad does this) or load the file as unicode.

I write all my codes with unicode compatibility nowadays.

Rui Martins

April 27, 2005, 02:35 AM

You probably have a bad pointer or a out of bounds array access somewhere, causing trashing of nearby memory.

TRace/debug your program until you reach the place where you load the string from file. Confirm that you load it correctly, which you probably are doing correctly, then step through your code, until your variable gets screwed up, that is where the culprit is.
A good debugger will let you break with a trigger of data changed, which is ultimality far more easier than to trace it yourself.


May 02, 2005, 06:41 AM

Zero width nobreak space?

This thread contains 5 messages.
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.