so that it will be data free from the beginning, thus allowing the program to rewrite the same data onto an empty, but identical, file. Data is being copied from
"The Adopted.txt"
and
"The Originals.txt"
The truncation wipes the the file completely, and nothing replaces it by the end of the program.
Can someone please help me understand what I've done wrong (presumably in line 26 with trunc declaration). I've been nose deep in references for hours. Thanks!
That worked for printing the data. But the file still doesn't clear at the beginning, and display at the end. That's what I'm attempting to do. Is it possible? Removing the () basically made it as if the trunc were never there.
You could in fact remove line 26 since line 10 has already opened the output file for you.
Also your file merge is incomplete. When the end of one file is reached, no further lines are processed from the other file - that's a logic error. You could try something like this:
Well you might just be a lifesaver because after testing your code I found that I had been missing a couple units from one of the files!! Goodness. Thanks you so much!
I just have one more quiestion.
When I call the .txt files to open or close, am I supposed to SEE either of these things happening, or are they in background? I would think that open would pop the tab open on the IDE for said file?
When I call the .txt files to open or close, am I supposed to SEE either of these things happening, or are they in background?
You won't usually see anything happen. (but it might be system-dependent).
When the output is closed, the file buffer is flushed and any remaining text is physically written to the file, as well as updating the file attributes such as date modified. When I tested this, I had the output file open in a text editor, which does pop up its own message when that happens, but i don't think all editors behave that way.
As for opening the file, the changes won't necessarily be reflected (I think) until either some data is physically written to the file or when it is closed.