I am trying to read the first line of text from an input text file into a character array but I am stuck reading until the array is filled to MAX_CHAR.
while (j < MAX_CHAR && !InFile.eof() && crypt[j] != '\n')
{
InFile.get(crypt[j]);
j++;
}
I have tried a few different alternatives like setting boolean values to stop once a '\n' character is read, but nothing has worked. Also, later in the program, I have this code written:
else if (decipher == '\n')
{
cout << '\n';
break;
decipher is set to the character array at a certain for loop value. When evaluated, the newlines are printed, so I know the file has the new line characters, but I do not know how to use them to end the array read.