ok it doesn't segfault this time, but the check for json still no work

master
ieee 802.11ac 2 years ago
parent 1822abcbc7
commit 0481166c1b

@ -36,28 +36,30 @@ int main(int argc, char **argv)
}
}
}
for (int i; i < argc; i++) {
char* arg = argv[i];
int filename_length = 0;
for (int char_count; char_count < 500; char_count++) { // how to not check file types; note to self, make this work with magic numbers and not file extensions
if (arg[char_count] == '\0') { filename_length = char_count; break;}
}
for (int j; j < filename_length-5; j++) { // why am i allowed near a computer
arg += j;
}
if (!strcmp(arg, ".json")) {
std::cout << "oh god it worked" << std::endl;
}
}
std::cout << "debug: " << debug << " help: " << help << std::endl;
if (help) {
std::cout << "this is a factorio clone. we don't have a working name for it yet, but dragon lord suggested \"beurocra-tech\"" << std::endl;
std::cout << "usage: " << filename << " -dh <*.json>" << std::endl;
return 1;
return 0;
}
if (debug) {
std::cout << "filename: " << filename << " default path: " << defaultPath << std::endl;
}
for (int i = 0; i < argc; i++) {
char* arg = argv[i];
char* arg_kept = arg;
int filename_length = 0;
for (int char_count = 0; char_count < 500; char_count++) { // how to not check file types; note to self, make this work with magic numbers and not file extensions
if (arg[char_count] == '\0') { filename_length = char_count; printf("it worked up to here"); break;}
}
for (int j = 0; j < filename_length-6; j++) { // why am i allowed near a computer
arg += j;
}
if (!strcmp(arg, ".json")) {
printf("oh god it worked");
printf("%s", arg_kept);
}
}
return 0;
}

Loading…
Cancel
Save