I have a C# application that runs C++ executables (that were created by Visual Studio) as separate processes. I have encountered some strange behavior involving the noskipws manipulator, which I realize serves absolutely no purpose in the following C++ code snippet. ifStm is an ifstream object opened in the binary mode and ofStm is an ofstream object opened in the binary append mode.
ifStm >> noskipws;
for (int ch; (ch = ifStm.get()) != EOF;)
ofStm.put((char)ch);
The purpose of the loop is to append every character in the input file to the output file, and it works perfectly when run directly or when run from the C# application without the noskipws statement. However, when run from the C# application with the noskipws statement the output file ends up with random missing characters or garbage everywhere. It appears that noskipws actually negatively affects the performance of non-formatted input functions and I'm wondering if anyone knows why.
Thanks :-)