| 364 | } |
| 365 | |
| 366 | std::string getFileText(const char* file) { |
| 367 | std::string text; |
| 368 | if (!file) { |
| 369 | return text; |
| 370 | } |
| 371 | |
| 372 | FILE* fp = fopen(convertPathToDelims(file).c_str(), "rb"); |
| 373 | if (!fp) { |
| 374 | return text; |
| 375 | } |
| 376 | |
| 377 | fseek(fp, 0, SEEK_END); |
| 378 | unsigned int i = (unsigned int)ftell(fp); |
| 379 | fseek(fp, 0, SEEK_SET); |
| 380 | |
| 381 | char* temp = (char*)malloc(i + 1); |
| 382 | fread(temp, i, 1, fp); |
| 383 | temp[i] = 0; |
| 384 | text = temp; |
| 385 | free(temp); |
| 386 | fclose(fp); |
| 387 | |
| 388 | return replace_all(text, "\r", std::string()); |
| 389 | } |
| 390 | |
| 391 | std::vector<std::string> getFileTextLines(const char* file) { |
| 392 | return tokenize(getFileText(file), "\n", 0, false); |
no test coverage detected