From d920e5d62020d751ccaa3491cc66275ade749011 Mon Sep 17 00:00:00 2001 From: quou Date: Fri, 27 Dec 2024 18:52:48 +1100 Subject: building and running on windows with visual studio --- sc/sc.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'sc') diff --git a/sc/sc.cpp b/sc/sc.cpp index 0f61fdf..3c39b0c 100644 --- a/sc/sc.cpp +++ b/sc/sc.cpp @@ -62,10 +62,7 @@ bool rf(const char* n, char*& buf, size_t& size) { rewind(f); buf = new char[size + 1]; buf[size] = 0; - if (size != fread(buf, 1, size, f)) { - delete[] buf; - return false; - } + buf[fread(buf, 1, size, f)] = 0; return true; } @@ -708,6 +705,7 @@ int main(int argc, const char** argv) { Desc desc; if (argc < 3) { print_err("Usage: %s infile outfile.\n", argv[0]); + return 1; } if (!rf(argv[1], src, src_size)) { print_err("Failed to read %s\n", argv[1]); -- cgit v1.2.3-54-g00ecf