Hi, I've written a piece of code that should read in a text file, store it in a string, then print it out on screen.
Problem I have is that as fscanf doesn't like spaces it won't read a full sentence, it will only print the first word of the file! So 'the quick red fox' comes out as 'the'.
/*declare and initialise variable*/
/*stores and prints the data from the string*/
I'm thinking I need to use something like fread but I'm just not sure how to implement it into the code.
(I also have another problem, I need to let the user specify the name of the text file, but not sure how. Guessing I need to get a scanf in from the keyboard to put the file name in a variable, but not sure how to apply the content of that variable to the filename section? If anyone could shed any light on that too)