Hi All
I need to make a settings file with quite a lot of entries.
I was hoping to include some sort of Text Tag in the file so I can follow which setting goes with what without them necessarily being saved in the exact same order.
E.G.
[Default_Printer]
Ricoh MP75
[Label_Printer]
Datamax e-class
[Receipt_printer]
Epson TM2001
[AUTOPRINT]
YES
[AUTO_SMS]
YES
and so forth.
In other words, I need to save with those tags and when reading, need to look for the tags and then the information that follows after that.
I have to use the CWSTR of José.
In Powerbasic i had markers like <> and used a UDT to save the info, but that does not seem to be the best way of saving info.
Can someone show me ho to parse a file like that with those "tags"?
Regards,
Peter
Dear Petrus,
Have you considered using functions like GetPrivateProfileString and WritePrivateProfileString? Were used in the past for storing settings in .ini-files, but they can be used for your purpose, I guess.
Wilko
Simplest answer: Use José's CIniFile class, which reads and writes to standard INI files. You'll find the instructions in the Help/WinFBX section under File Management.
Here's his example of open an INI file, save a value to a category in it, read it back, print the result:
#include once "Afx/CInifile.inc"
USING Afx
DIM cIni AS CInifile = "Test.ini"
cIni.WriteValue("Test", "Name", "Joe Doe")
DIM wszName AS WSTRING * 260
wszName = cIni.GetString("Test", "Name")
print wszName
PRINT "Press any key..."
SLEEP
Afterwards, take a look at TEST.INI with any text editor that can read wide strings (like WinFBE).
Phil
Hi All
Thanks for the help!
I think that's just about what I need.
Much appreciated.
-Peter
Works like a charm.
Exactly what I needed, and very simple to use.
Thank you!
-Peter