i created a console application that reads from a file line by line, each line has values separated by ','
when i debug my application everything works fine but when i run my application directly from the ".exe" file on an other Computer it works fine but sometimes the line read contain bad characters and not the real data. here is an example of the data :
Cannot be sure without the actual text file, but it sounds to me that it could be a different text encoding. I am not the super fan of using filestream objects in C++ as I do all my reads and writes with ReadFile() and CreateFile() (Windows API), so I am unsure about the facilities to provide an adequate encoder.
Now, have you examined the differences between the text file in used by the .exe and the text file used while you debug? They are bound to have a difference.
I've noticed that "EXECUTED, " has 10 characters (80 bytes) and "höü³ " has 5 characters.
Can I assume that you've compiled the .exe file on two seperate computers and have tried to read the same .txt file on each?
My guess is that one version of the .exe is reading the file as a bunch of wchar_t while the other is reading it as char. Try using the same .exe on each machine or try checking the compiler pre-compilation settings.
My reason for thinking this is:
If I use RegOpenKeyEx() on my work machine (VS 2008) it defaults to RegOpenKeyExA which uses the ANSI or 8bit character. Meanwhile if I use RegOpenKeyEx() on my home machine (VS2010) it defaults to RegOpenKeyExW which accepts only UNICODE or 16 bit characters. The difference in how my compiler accepts data for these functions leads me to believe that there could be differences in how they absorb basic IO (depending on which Win32 functions you use).