|
-
Oct 20th, 2001, 10:22 AM
#1
Thread Starter
New Member
Editting .txt files?
A few questions here. Let's suppose I have a text file named test.txt. In that text file I have the following:
-------------
[Accounts]
Total = 2
Test=Test1
Test2=Test3
-------------
I know how to add text to the text files but what I would like to do is each time the user adds some text to the text file, I would like the "Total" to increase by 1. So if they add 2 more to the above text, the Total would increase to 4. Does that make sence? Thank you in advance.
- Ilya
-
Oct 20th, 2001, 10:33 AM
#2
PowerPoster
That format is the same as used in INI files, so I suggest you read/write to the file using API's designed for use with ini files (doesn't matter if it's actually a .txt)
http://www.vb-world.net/tips/tip17.html
http://www.vb-world.net/demos/ini/
The total thing you just need to increment when a value is added, and decrement when a value is removed using same APIs
-
Oct 20th, 2001, 11:26 AM
#3
You should use .ini for variable not a .txt
-
Oct 20th, 2001, 11:30 AM
#4
PowerPoster
-
Oct 20th, 2001, 11:37 AM
#5
Banned
Technically no, but it's more conventional.
-
Oct 20th, 2001, 07:01 PM
#6
PowerPoster
Hi
I think it would be much easier to use a text file rather than an ini file in this case.
1) Easier to code for
2) Less maintenance problems if one file is updated or deleted and the other isnt.
3) The ini file is oft abused and can grow like a weed
Anyway, if u are using accounts etc I would maybe suggest that you look into Random Access Files and User Defined Types. U may find it much easier to manage than using simple Input and Output files. And i cant give an example becos it is such a wide topic. Have a look around in MSDN Help, here etc for snippets of info.
Regards
Stuart
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|