ive read up on peek()...have a few questions regarding it...
1) does it check for a character or a word?
2) does it check for space? i know it checks if there is a newline next in the stream...
the reason i'm asking is because of my earlier tree question...if the file im reading is something like this:
above is a tree structure...where pat and hun are treenodes, none, some, full and yes are branches and NO, YES are classes these branches end up into...in the 3rd line the branch full does not end up into a class but connects to another node which is hun...
pat = none : NO
pat = some : YES
pat = full :
hun = yes : NO
now in my tree reading algorithm the 3rd line is the problem...there is a spaces after : in each line...
I want to have a check which tells me if there is a word after the colon or if there is noword there on that line...based on that i do two different algorithms...so would this work:
in >> word; //word is a string and assume i just read in : into word
if (in.peek() != '\n')
//does this mean that i have either YES or NO here?
if (in.peek() == '\n')
//does this mean that if i do in >> word now i'll have the value hun in word?