The 2024 Wheel Reinvention Jam is in 16 days. September 23-29, 2024. More info

Day 037 ReadEntireFile Call failing and BMP not getting loaded

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?

Edited by Lokit Khemka on
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
If you're using Visual Studio to run executable, then this was covered in Day 1:
https://guide.handmadehero.org/code/day001/#2970

Edited by Mārtiņš Možeiko on