How would one go about reading in a line of characters from a file. First the program reads in an integer from the file. That number indicates how many characters to read in in the next step.Next reads the characters in and store them in an array. So how do i create the 'char' variable so that i can correctly read in the characters from Michael to displaying them in an array.
file.txt:
8
Michael
im using inputFile >> integer, from there i need that integer to use to make this array char mike[integer];, then i can read in the chars to the array
To answer your question:
But, I would go with (if your
Michael
appears on its own line):This gives output off the following string in
file.txt
.