variables - Reading a number from a multi-line txt document in c++ -


i'm making program, , have .txt file need read from, , commands from. text document looks like:

u r f 10 d f 13 q 

and need numbers out of it. way im reading file ifstream object named instream. i'm using

while(instream.get(charvariable)){     switch(charvariable){     case 'f': //do forward command        break;     ...     } } 

the forward command needs take line, does, , needs read f, skip space, , whole number int variable. i'm new c++, need doing that.... how number, read single char variable, integer variable? great! thanks

streams move read them. means when have read f stream next input integer. , since work on formatted input stream skip white space when use >>

while(instream >> charvariable)){     switch(charvariable){     case 'f': //do forward command        int nr;        instream >> nr;        // number.        break;     ...     } } 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -