Basically my question is: "How can I write next to something in a file"
For example in the target file stands:
30
23
45
.
.
.
how can I then write something like
30 40
23
45
...
Till now I managed to read a string, and sort out the two numbers. For example the first line up above would lead to: indicator_str = 30 and a temp_str = 23.
To make things easier I now would like to print the indicator_str once and after that the temp_str underneath it, then read the next line from the file (leading to indicator_str = 30 and temp_str = 45), realize that it's the same indicator and therefore just print the temp_str in the next line.
So far so good. My problem for that is that if indicator_str changes (for example to 40) I would need to write next to something existing in the target file and not underneath. Would I need to read from the target before and print the entire new string or is there a special function in c++ that could manage that problem?
that's exactly what I'm trying not to do. It was supposed to be a tiny helper ... Now it's a huge load of programing and brainpain :P.
I tried something like this with fseek in C (I'm writing c++ right now) but that didn't worked at all. For some weird reason it didn't even delete the old line. It just added the line to the end of the file.
fseek and co work fine, maybe you messed up the parameters(and it is easy to mess up) but the probleme is that it does not insert the data in the file but replace it, that's why it's difficult for your problem. I am pretty sur there is no way to insert data into file, that's why i think the easyest solution is to proceed as i said before.
I wouldn't blame the fseek function that it didn't work. How you said. Pretty sure it was me :P
I just figured out that the problem disappeared since there never will be the source file ... just waisted time and server space again :(