I don't see anything wrong with that code. Make sure the file is in the current directory (if you're running the exe from an IDE like Visual Studio or Code Blocks, the current directory is typically the project folder and not the same folder that the exe is in)