Register
Handmade Hero»Forums»Code»Day 037 ReadEntireFile Call failing and BMP not getting loaded
Lokit Khemka
4 posts
Day 037 ReadEntireFile Call failing and BMP not getting loaded
1 week, 4 days ago Edited by Lokit Khemka on Sept. 13, 2020, 1:10 p.m.
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
882 posts
Day 037 ReadEntireFile Call failing and BMP not getting loaded
1 week, 4 days ago
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
2126 posts / 1 project
Day 037 ReadEntireFile Call failing and BMP not getting loaded
1 week, 4 days ago Edited by Mārtiņš Možeiko on Sept. 13, 2020, 9:32 p.m.
If you're using Visual Studio to run executable, then this was covered in Day 1:
https://guide.handmadehero.org/code/day001/#2970