for (int y=0;y<MapH;y++)
{
for (int x=0;x<MapW;x++)
{
fscanf(FileName, "%d:%d ", &a, &b);
}
}
This works really well for loading map using the format "A:A " but I want to use the C++ way, since we all know how fscanf, scanf, fprintf etc can screw you over.
can anyone help me with this, I want to be able to read in this format but I don't want to get each line to do so...
The >> operator only reads in from the file information that matches the requested type. So if you ask for an int it will only read in an integer. Also it will skip any leading whitespace.
I don't understand why it is working now and it wasn't a minute ago... but thanks a lot man, it is working now, but it is seriously weird, I had the same function with a char and everything but it just wasn't doing it :/
I deleted the whole function and rewrote it back, some time you could miss a single minuscule variable and it will mes you up... thanks again bro.