Im trying to copy a whole .txt file into a char array. My code works but it leaves out the white spaces. So for example if my .txt file reads \"I Like Pie\" and i copy it to
A simple solution if you're bound to using char arrays, and minimal modification to your code. The snippet below will include all spaces and line breaks until the end of the file.
while (!myfile.eof())
{
myfile.get(myArray[i]);
i++;
num_characters ++;
}