I was reading a tutorial for the seekp and seekg commands a couple weeks ago and I saw something about getting seekg to the same spot as seekp to input a variable to the opened file where seekp was. I'm making a little program right now that I'm using fstream and I can't seem to remember how they did that and I have no idea where the tutorial was located. I seem to remember it was something like filename.seekg(filename.seekp, ios::beg) or something like that.
I was wondering what's the best way to input/output text from a file in an organized type way, and if that command I read in the tutorial was the best way. I'm trying to have a list of things that involve money, with a total money section. I don't know if that would help, but it doesn't hurt.
Sorry if that didn't make any sense, but I would really appreciate if someone helped me out or at least pointed me in the right direction.
Yeah, that helped somewhat. Most of the stuff I knew, except for the tellg and tellp and some various other things. I'm still a bit lost on how to modify/add things to files efficiently.
Thanks guevara and duoas. Maybe it's just cause I'm extremely tired I'm not getting it.
I'm still wondering how exactly I edit stuff, maybe I just need to work with fstream and play around some more, I've only had experience with reading and writing new text into .txt files with some labs I've done for my C++ programming class.
Is there anything that you would suggest I try to improve my understanding of fstream? I'm just trying to make sense of it right now, I get the whole open file, write/read from it but I'm still not exactly sure the proper procedure to read out the text and edit certain parts.. I'll try it again once I get some sleep and not have so much other stuff to do. I feel like I'm missing something important.
Could someone explain the procedure in pseudocode or something if it's not much of a hassle. All I've got so far is that I need to open up the filestream in binary mode but I'm not exactly sure what to do after that. I'll try it again tomorrow and see if I get it. I'm just trying to make a program to add/subtract transactions and input the data into a text file, then read it out and give the option to add more transactions and edit old ones. Then somewhere in there add all the information up and present a total balance. One of the problems I've been trying to solve is making it organized so the information doesn't end up in a wrong variable somewhere.
Sorry for making a simple thing such a problem though, there probably is an answer that I need in the links you guys have been giving me though. Sometimes I'm just not that good at reading out of a tutorial or finding answers indirectly.