fstream::eof() - returns true if the 'eofbit' has been set by a previous i/o operation.
fstream::read(s, n) - sets 'eofbit' if the End-of-File is reached before n characters have been read.
The file has only 5 characters and the while loop will execute twice. In the first pass you try to read 5 bytes and it will be success. In the second pass read will fail and sets the 'eofbit'. Since you are not checking how many bytes read, you cout the old buffer contents again.
This is the reason why you got "abcfabcf".
The code can be changed to print "abcf" once, by checking the bytes read using fstream::gcount() as
If the program changes its own caption internally using SetWindowText() then there is nothing you can do directly. However, I believe there is a function that allows you to set a hook process which can monitor all messages, so you could intercept the WM_SETTEXT and act appropriately. But it sounds like a lot of hard work for no discernible benefit.
And the third possibility (after API hooking and editing the executable in a hex editor) would be:
Contact the author and ask for it, for example with a special build or a new runtime setting. If the application is open source you could even do it yourself, otherwise check what the author/vendor thinks about it. Some are happy to help, especially when you can explain why this feature would improve the end user experience for (one of) their customers.
In VS2008 neither /IGNORE nor #pragma warning(disable:4099) work for that message.
I'd like to compile debug build and I'm using a lot of libs they garbage the output window too much with those 4099 warning
I'm looking into porting some apps to VS2010 for a client. Some of their tools manipulate the .rc file directly. Could anyone with VS2010 installed please send me a .rc file that was created with VS2010 (not converted, but actually newly created by VS2010). Thanks!