Question about fstream?

Can some one explain to me in less complex terms and maybe give an example of what fstream is and what it is used for.

Im curious if its telling me how to insert a file into my code. Maybe a file that can hold say a formula that is used in my program.
Last edited on
Do I have to create a separate file on a separate blank project or does the code it self do that for me when ran? The book from my class and the sites information is confusing me a little. On another note does it matter whats in the file? Does it have to be in code or is it a reference point for say, maybe a more detailed explanation of what is going on in the program? Or is it a reference point to more code that when accessed it implements more functions into the program... Ive been at this a while and this is briefly explained in the back of chapter and I was confused about what i read so i came here. I did read what I could find on fstream but it wasn't what you sent me.. I did seem to get more out of what you sent me but Im still a little confused about what exactly it does and how to use it... Im Probably about to call it quits for the night and start fresh tomorrow...
Thank you for your time and I would love to hear more.

If you try to load a file, and it doesn't exist, it will be created for you. You can define any type of data in a .txt file. It is common to use to create a custom parser that will search the text document for you, extract the necessary data, and close the file, OR to open a file, load data into the text file in a organized format, and then close file.
@Aim3Erudite: A file can contain anything you want it to contain.

Mr D wrote:
If you try to load a file, and it doesn't exist, it will be created for you.
False. A file is only created if you open it for writing. If you only open it for reading it is not created.
Last edited on
I apologize, that is what i meant. It creates a file when you attempt to open it.
Topic archived. No new replies allowed.