ppm file to buffer

Dec 5, 2016 at 1:46pm
How can i save a ppm file into a buffer byte by byte?
Dec 5, 2016 at 2:45pm
1
2
3
4
5
6
7
8
9
10
11
std::string load_ppm(std::string filename) {
    std::ifstream handle(filename);
    std::string contents;
    char byte; // the char datatype is guaranteed to be 1 byte.

    while(handle >> byte) {
        contents += byte;
    }

    return contents;
}
Last edited on Dec 5, 2016 at 2:46pm
Topic archived. No new replies allowed.