Reading commands from a file

I'm making a program that has a Stack and Queue class, and it's supposed to read a text file that has commands and data on it like this:

push 10
pop
serve
append 35
... etc.

I know how to use streams to read integers or characters from a file, but I'm not sure how I'm supposed to get separate the command from the data value and get the program to issue those commands just from reading them. I might be overthinking it, can anyone explain how that's done?
Read the operation first. Then decide if you need to read an operand.
Topic archived. No new replies allowed.