How do I modify a record in a textfile in vb?

  • Thread starter Thread starter RBCC
  • Start date Start date
Hi Herfried,

Did I forget again something?

I thougth one file to read the data and one file to write the changed data
back.

I am curious, because now you bring me in doubt that I have seen something
from you to do it in another way.

Cor
 
Hi Herfried,
Why not write the data back to the same file?

I am glad I can teach you something,

That is something you never should do.

You cannot prevent that by example on an unwanted moment the power goes
down.

So with streaming operations it has for me always to be.

Read file
Write file to tempfilename
delete inputfile
rename tempfilename to original name

Or any other save sequence of this.

Cor
 
Cor said:
Hi Herfried,


I am glad I can teach you something,

That is something you never should do.

You cannot prevent that by example on an unwanted moment the power
goes down.

So with streaming operations it has for me always to be.

Read file
Write file to tempfilename
delete inputfile
rename tempfilename to original name

Or any other save sequence of this.


I've made the same suggestion but I was adviced not to do it because it
would change the file creation date or the original file. Another way is to
create a backup of the original file, read from the backup, write into the
original file (and truncate it if necessary) and delete the backup.
 
Cor,

* "Cor said:
I am glad I can teach you something,

I am glad to teach you something too.
That is something you never should do.

You cannot prevent that by example on an unwanted moment the power goes
down.

So with streaming operations it has for me always to be.

Read file
Write file to tempfilename
delete inputfile
rename tempfilename to original name

No! This will change the creation timestamp of the file. Better:

Read File
Write File to Tempfile
Overwrite File with Tempfile
Delete Tempfile

;-)
 
Hi Herfried,

And what is your advice if I want to change the creation timestamp because I
find every change of a txtfile a creation?
No! This will change the creation timestamp of the file. Better:

Read File
Write File to Tempfile
Overwrite File with Tempfile
Delete Tempfile
Still it are two files and I said any other save sequence so there cannot be
a better.

:-)))

Cor
 
* "Cor said:
And what is your advice if I want to change the creation timestamp because I
find every change of a txtfile a creation?

Mhm... I don't want that and I wouldn't use an application doing that.
 
Hi Herfried and Armin,

Was a big travel to find something to answer.
I first had the historie from dataprocessing but that is to simple to give
an answer for you both while I become than in a corner where it is hard to
fight back..

I thought about this.

Changed means that things stay the same.

Although this is on disk and not on memory this is for me the same as

datafile as new datafile
And not
Datafile = olddatafile

And therefore I think it is newcreated.

And not an easy answer as

No I do not agree.

:-))

Cor
 
Cor,

* "Cor said:
Was a big travel to find something to answer.
I first had the historie from dataprocessing but that is to simple to give
an answer for you both while I become than in a corner where it is hard to
fight back..

I thought about this.

Changed means that things stay the same.

Although this is on disk and not on memory this is for me the same as

datafile as new datafile
And not
Datafile = olddatafile

And therefore I think it is newcreated.

If you change a record in a 2 GB database, do you really think the
database should be completely recreated?
 
Hi Herfried,
If you change a record in a 2 GB database, do you really think the
database should be completely recreated?
As I said I had made more messages about this and one was about a database.

I told you once never change the subject if you are arguing. I started in a
part where you could maybe beat me, now you are on one of my areas.

A database is updated by updates, inserts and deletes, never by New, so you
give exactly the answer that you agree with me, things like databases have
creation and change dates. New files should be treathen as always new
created.

Cor
 
* "Cor said:
A database is updated by updates, inserts and deletes, never by New, so you
give exactly the answer that you agree with me, things like databases have
creation and change dates. New files should be treathen as always new
created.

Full ACK. Nevertheless, if you change a record in a text file
"database", it's only a change.
 
Back
Top