-
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
-
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
-
You should use .ini for variable not a .txt
-
-
Technically no, but it's more conventional.
-
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