I know that you can't directly return an array from a function, but I'm a little shaky on how to use pointers with arrays.
I've tried using a function like this to read data from a file and assign it to an array via a function:
The .dat file is simplyCode:ifstream fin; char array[4]; void readText(char *array) { for(int i=0;i==sizeof array;i++) *(array+i)=fin.get(); }
When I use cout to display the contents of the array that should have received the data from the file, I only receive 4 blank spaces. Apparently nothing is being written to the array, but I don't really understand what exactly is going on.Code:TEST