The program stays open. Really, what I'm trying to do is, in a command line program, entering a sentence and having that recorded in a variable and then displaying that back to me?
I'm not sure how to do it?
Thought the stringstream object would let me do that but I'm not sure how.
Hi Nathan.. Thanks very much for that.. You too deceptikon..
Thats perfect for what I need.
Was wondering though, and this is an additional question really, how would I store a sentence read from text into a variable. I know know if if is input from a keyboard I would use the above process but if I have a sentence from somewhere else how would I go about it? If I put the sentence in a variable I can use it later on for something else.
What do you mean by getting the sentence from somewhere else? Do you mean like getting it from a file or passing the variable to the program using the command line? If you put the sentence in a variable you can use it in your progrma anywhere you want to as long as that variable is visable to the code block you are in.
You can use the same method. Instead of using cin you would use the file stream you create.
ifstream fin("testfile.txt"); //create ifstream object to read the file
As you can see from the above example fin is the file stream to read from the file. fileContents is a vector that will store each line of the file. The while loop uses the return value from getline to know if a line was read from the file. If the getline operation fails the loop stops and nothing more is read from the file. Inside the while loop the contents of the variable line are then added to the back of the vector.
If you want a good reference site I would suggest visiting cplusplus.com. They have a lot of tutorials and references. And of course if you have problems come back here and someone should be able to help.
For Each ctrl As Control In Me.Controls("pnlMainPanel").Controls
If ctrl.GetType Is GetType(System.Windows.Forms.Panel) Then
For Each subCtrl As Control In ctrl.Controls
If subCtrl.GetType Is GetType(System.Windows.Forms.TextBox) Then
If subCtrl.GetType Is ...