This code reads from input stream up to first whitespace or new line character. It will not work in case of "A roza upala na lapu azora".

replace it by getline( instream, text );