C++ File Input and Output
HTML-код
- Опубликовано: 10 фев 2025
- In this video you will learn to take in input from a file and output to a file using the fstream library in C++.
Production: Shmeowlex
Graphics : Shmeowlex
Editing: Shmeowlex
#C++ #Programming #ComputerScience
Tried this code on Replit for Android and it works. Thanks!
Glad I can help :)
That was a Great explanation man, thanks. You saved me a lot of time and effort.
Glad I can help :)
Thanks man, you helped me a lot.
Glad I could help!
Thanks! It helped me a lot.
Glad it helped!
Nice. But i dont think you should exit with a return 0. You could return with -1 or EXIT_FAILURE
Great explanation sir. 💐🌷🌹🥀🌻🌼
Glad I can help :)
well explained way better then my professor fr
Glad I could help!
great video
Glad you enjoyed it
Great explanation ! thank you
You are welcome!
Great video
Glad you enjoyed it
🤠
Is there a need to check if the output file exists? Because from what I know, the output file will be created automatically in the project folder if it does not exist
If the path to the file is invalid it will fail (i.e. if you wanted to place your output in an output directory but the output directory was not created yet).
@@shmeowlex Understood, thanks!
Why does the info get deleted when I run the program again even though I wrote endl at the end? and how do I prevent that from happening?
output files get deleted and recreated every time you open them.
I need help sir, I am using a MacBook Pro and I can't open these files or create one for that matter, I would appreciate your help
The files are ones I created
bro u r amazing
Glad I can help :)
I have one question: after making the file, where does it get stored? I am using an arduino R3 and a SD card as my source of storage, how do I move the file to an external drive?
I am not familiar with the arduino platform unfortunately :(
I have a question. What if your input and output files are the same? I mean like the results of your input has to be added to the same file?
you would need to read everything in from the file into arrays, then output everything with the appended data.
is there a function build in or something so i aim at certain string/line of txt file with fstream ?
No, you would need to read through the file
Very helpful
Glad to help.
why are you using return 0 on if statement, i cannot get the logic?
To terminate the program.