I used open to open the filename, e.g,
std::ofstream file;
file.open(filename); (code from the internet)
and then I used a while loop to go through every element in vector data, and used
file << data[i];
to write every element into the file. I also did flush and close to the stream, and there were truly something written into the output ppm file, but the ppm file cannot be opened at all.
The size of each ppm file is about 432 kb, while the gray one is 1/3 of the normal size.
When I tried to open the ppm file, there is a tip says "load meta information failed".
Any ideas?
I used open to open the filename, e.g, std::ofstream file; file.open(filename); (code from the internet) and then I used a while loop to go through every element in vector data, and used
file << data[i];
to write every element into the file. I also did flush and close to the stream, and there were truly something written into the output ppm file, but the ppm file cannot be opened at all.
The size of each ppm file is about 432 kb, while the gray one is 1/3 of the normal size.
When I tried to open the ppm file, there is a tip says "load meta information failed".
Any ideas?