I know how to read a file ad use it, but Im not sure how to open the file and output its contents on the screen.
How can I do that in main() in a basic C++ code?
I know how to read a file ad use it, but Im not sure how to open the file and output its contents on the screen.
How can I do that in main() in a basic C++ code?
You have create an istream object and use it to open up a file. Then you can use some of it's member functions like get to extract either lines or individual characters from the file. Then you can output the results right away or save them in another variable to output at some other time.
Im not sure if i get what you're saying lol...Im kind of still a beginner...Would u write up a short code as an example please
No, what you're asking can easily be found in tons of tutorials, books, and other threads. Just do a search.
How could you know how to open a file, read from it and use it, but not know how to print its contents to the screen?
Just 'cause he knows the code to open a file and use it. Doesn't mean he understands it