How do I modify a record in a textfile in vb? Do I need 2 files?
JOhn
---
Posted using Wimdows.net NntpNews Component - Posted from .NET's Largest Community Website: http://www.dotnetjunkies.com/newsgroups/ 15 1102
Hi John, How do I modify a record in a textfile in vb? Do I need 2 files?
Yes
Cor
* "Cor" <no*@non.com> scripsit: How do I modify a record in a textfile in vb? Do I need 2 files?
Yes
Why?
--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
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
* "Cor" <no*@non.com> scripsit: Did I forget again something?
No, you didn't.
I thougth one file to read the data and one file to write the changed data back.
Why not write the data back to the same file?
--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
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" <no*@non.com> schrieb 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.
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.
--
Armin
Cor,
* "Cor" <no*@non.com> scripsit: Why not write the data back to the same file? 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
;-)
--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
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" <no*@non.com> schrieb And what is your advice if I want to change the creation timestamp because I find every change of a txtfile a creation?
change <> creation
(IMO)
--
Armin
* "Cor" <no*@non.com> scripsit: 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.
--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
* "Armin Zingler" <az*******@freenet.de> scripsit: And what is your advice if I want to change the creation timestamp because I find every change of a txtfile a creation?
change <> creation
(IMO)
2:1
--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
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" <no*@non.com> scripsit: 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?
--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Hi Herfried, 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?
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" <no*@non.com> scripsit: 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.
--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Franco Fellico' |
last post by:
Hi.
Suppose to have read and displayed (using PHP) a group of row of a DB
table on a dinamyc table on a HTML/PHP page.
The number of row displayed could be from 1 to n. Each row contains...
|
by: Hans A |
last post by:
I have a textfile "textfile.txt" containing a list of words. There is
one word on each line. I want to pick two random lines from this
textfile, and I have tried to do something like:
//Loading...
|
by: Gunnar G |
last post by:
Hello.
If I wish to open a huge textfile and only change the 300th line in the
file, how do I do that?
|
by: karenmiddleol |
last post by:
The following code works fine I can connect to a SQL database and list
all the records in the Orders table onto a web page.
Now our users want me to modify it so that each row displayed as a...
|
by: asd987 |
last post by:
Hi,
I'm now working with Access 2000 (English) and I'm searching for an option
which I can't find. I used to work with Acces 97 (Dutch) and there was a
possibility to record a macro. I used this...
|
by: muttu2244 |
last post by:
Hi everybody
Am trying to read a csv file "temp.csv", which has the below info,
compName macAddr ipAddr
opSys
|
by: Jen |
last post by:
Is it possible (how) to display a new record every week (or day) from a
recordset?
|
by: Ray |
last post by:
Hello World,
I made a Windowsform that reads data from a CSV file.
It works fine, but when I have read the data of a record I have to re-Debug
the form to read another record.
So when I put a...
|
by: asedt |
last post by:
With my Excel macro and two text files I want to create a new textfile containing the first textfile then text from the sheet and then the second textfile.
My problem is that i don't know how to...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |