Handmade Hero»Forums»Code
Lokit Khemka
4 posts
Day 037 ReadEntireFile Call failing and BMP not getting loaded
Edited by Lokit Khemka on
When the program is calling DEBUGLoadBMP function, the ReadEntireFile function inside is failing and it is returning ReadResult zero? Please help with this problem. Thank you.

It is happening even if I am using Casey's platform layer.

EDIT: As it turns out, the executable is not loading data from data folder but the directory with the source code. How can I change the data folder?
Simon Anciaux
1337 posts
Day 037 ReadEntireFile Call failing and BMP not getting loaded
You need to set the working directory in the visual studio project properties.
- In the solution explorer > right click on the desired project > properties > set the "working directory" line to the desired directory.

If you're running from the command line, you need to go to the desired directory and launch the executable from there.

1
2
3
rem Assuming you're in the code folder
cd ..\data
..\build\win32_handmade.exe
Mārtiņš Možeiko
2559 posts / 2 projects
Day 037 ReadEntireFile Call failing and BMP not getting loaded
Edited by Mārtiņš Možeiko on
If you're using Visual Studio to run executable, then this was covered in Day 1:
https://guide.handmadehero.org/code/day001/#2970