C++ :
std::filesystem::path filePath(argv[1]);
std::ifstream file(filePath, std::ios::binary);
std::string fileSource((std::istreambuf_iterator<char>(file)),
std::istreambuf_iterator<char>());
std::cout << fileSource << std::endl;
retarded
C :
FILE* f = fopen(argv[1], "r");
fseek(f, 0, SEEK_END);
size_t sz = ftell(f);
fseek(f, 0, SEEK_SET);
char* src = malloc(sz+1);
fread(src, 1,sz, f);
fclose(f);
src[sz] = '\0';
printf("%s\n", src);
retarded
Python:
with open("file.txt") as file:
data = file.read()
print(data)
simple, just works
cniles and npc++ btfo