Skip to content

Commit 21edd83

Browse files
satchelfrostKillerxDBr
authored andcommitted
allow file sizes greater than 2GB to be read on windows
Co-authored-by: KillerxDBr <antonioroberto1407@gmail.com>
1 parent 9ed34d8 commit 21edd83

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

nob.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1514,7 +1514,11 @@ bool nob_read_entire_file(const char *path, Nob_String_Builder *sb)
15141514
FILE *f = fopen(path, "rb");
15151515
if (f == NULL) nob_return_defer(false);
15161516
if (fseek(f, 0, SEEK_END) < 0) nob_return_defer(false);
1517+
#ifndef _WIN32
15171518
long m = ftell(f);
1519+
#else
1520+
long long m = _ftelli64(f);
1521+
#endif
15181522
if (m < 0) nob_return_defer(false);
15191523
if (fseek(f, 0, SEEK_SET) < 0) nob_return_defer(false);
15201524

@@ -1930,6 +1934,7 @@ int closedir(DIR *dirp)
19301934
Revision history:
19311935
19321936
1.18.0 (2025-03-24) Add nob_da_foreach() (By @rexim)
1937+
Allow file sizes greater than 2GB to be read on windows (By @satchelfrost and @KillerxDBr)
19331938
1.17.0 (2025-03-16) Factor out nob_da_reserve() (By @rexim)
19341939
Add nob_sb_appendf() (By @angelcaru)
19351940
1.16.1 (2025-03-16) Make nob_da_resize() exponentially grow capacity similar to no_da_append_many()

0 commit comments

Comments
 (0)