well since I''m the master of ugly hacks...
make a char dummy =)
char dum;
file >> dum >> dum >> x; // ''X'', '':'', -20.500000
Of course, if this was fscanf you''d write fscanf("X:%f", &x); =)
and boost has a boost::format to make it possible to write like you do in scanf/printf but using the C++ iostream library. Or maybe the boost::tokenizer is more your taste?
Good luck!
}-- Programmer/Gamer/Dreamer --{
I didn''t choose to code, coding choose me.
Reading vertices and triangles from a file.
I solved it on my own.
My hack is even uglier I think.
[edited by - Grain on May 19, 2004 1:20:55 AM]
do{ch=file.get();}while(ch!=':');file >> x; do{ch=file.get();}while(ch!=':');file >> y; do{ch=file.get();}while(ch!=':');file >> z;
My hack is even uglier I think.
[edited by - Grain on May 19, 2004 1:20:55 AM]
Is there a reason you can''t just put a space between the colon and the number in your file? o_O
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement