Click to See Complete Forum and Search --> : INI FILE


kittusr
April 12th, 2001, 05:01 PM
C++ Gurus,

I Would like to create (this i would do it manually) an INI file, and read the properties from this file

Ex: if system.ini is the file name.

It would contain the properties like

System_Name=mysystem
Visible=true

From a CPP program i should be able to read the file and get the property i need,

char *a = getvalue("System_Name");

How do i do this ?

Any help on this would be appreiciated

Thanks!

cksiow
April 12th, 2001, 07:22 PM
you have to read the file into a string variable and then find the position of the start of the text that u want,

I hope u know how to read the file into string, if not, refer http://vblib.virtualave.net for a function call ReadFileStr in vbFileIO class.

say you got it into a variable call s,

then you need to get the start position, like this

l = instr(s,"System_Name=")

j = len("System_Name=")
k = len("mysystem")

after getting it, you can then use

x = mid(s,l+j,k)

if the file is INI, you might want to consider GetPrivateProfileString API to do it.

cksiow
http://vblib.virtualave.net - share our codes

Cimperiali
April 13th, 2001, 06:03 AM
Should not this be posted in C forum, to get quicker answer?

Special thanks to Lothar "the Great" Haensler. Come back soon, you Guru.

Iouri
April 13th, 2001, 07:05 AM
DO you want it in C++ or in VB?

Iouri Boutchkine
iouri@hotsheet.com

kittusr
April 16th, 2001, 06:27 PM
Yes i want this in C++, also if possible could you send me a link to any examples if you have.


Thanks for all the help!!

cksiow
April 16th, 2001, 07:07 PM
http://63.236.73.79/cgi-bin/bbs/wt/showpost.pl?Board=vc&Number=122483&page=&view=&sb=