ok, i''m too lazy to write a bitmap loader, so i decided to use the .raw file format
if you don''t know what that is, its the simplest file format ever
the file holds a user defined header of however many bytes you want, in my case 0. Then comes the 24-bit RGB data for each pixel. The file does not hold any other information
so i should be able to read in this data 3 bytes at a time using the standard c++ ifstream type deal, and I can, as long as the image is smaller than 7 x 7 pixels, but if the image is larger, i can''t
![](sad.gif)
heres my code that should work, but doesn''t
#include
#include
int main()
{
ofstream fout;
ifstream fin;
char r, g, b;
fout.open("mesh.raw",ios::out,ios::binary);
fin.open("circles.raw",ios::in, ios::binary|ios::nocreate);
fin.unsetf(ios::skipws);
fout.unsetf(ios::skipws);
while(!fin.eof())
{
fin >> r >> g >> b;
fout << r << g << b;
}
return 0;
}
really simple, it should just make a duplicate copy of the original file, but it doesn''t, it messes up all the data so that it has the right number of bytes, but the wrong values. The new file (mesh.raw) looks *similar* but not the same to the original. any ideas? Oh, and the file has to be a multiple of 3 bytes large, because it is in R G B format, so inputting 3 bytes at a time is technically ok.
-arsenius
''after three days without programming, life becomes meaningless'' -The Tao of Programming