Page 1 of 1 1
Topic Options
#42270 - 2003-06-30 08:40 PM Multiple WriteProfileString() ?
Austin Offline
Seasoned Scripter

Registered: 2002-01-24
Posts: 439
Just wondering about something. I am doing 4 sucessive WriteProfileString() calls that are all going to the same file and section. Can I consolidate these so that the file will not need to be opened four times but rather could simply write these entries at once.. problem is that the file is opened across the network.

Thanks
_________________________
Austin Henderson

Top
#42271 - 2003-06-30 08:43 PM Re: Multiple WriteProfileString() ?
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
No, you cannot.
_________________________
There are two types of vessels, submarines and targets.

Top
#42272 - 2003-06-30 08:52 PM Re: Multiple WriteProfileString() ?
Austin Offline
Seasoned Scripter

Registered: 2002-01-24
Posts: 439
hmm.. maybe a possible UDF?

I searched but didnt really find anything that looked promising.. maybe shoudl refine my search.
_________________________
Austin Henderson

Top
#42273 - 2003-06-30 08:58 PM Re: Multiple WriteProfileString() ?
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
A UDF won't help you either. You will need to use four WRITEPROFILESTRINGs if you want to write four sections/keys/values.
_________________________
There are two types of vessels, submarines and targets.

Top
#42274 - 2003-06-30 09:00 PM Re: Multiple WriteProfileString() ?
Austin Offline
Seasoned Scripter

Registered: 2002-01-24
Posts: 439
Possible UDF could take a 2D array in for entry and value.. could take in a path and a section. (four parameters)..Could use readline to find section and writeline to enter the values maybe? Just thinking out loud. See any problems with that just at first glance?
_________________________
Austin Henderson

Top
#42275 - 2003-06-30 09:10 PM Re: Multiple WriteProfileString() ?
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Yes, I do. WRITEPROFILESTRING is the most efficient way to write to .INI files. OPEN/READLINE/WRITELINE/CLOSE is slow, see the KiXtart Manual.
quote:
The file-I/O functions in KiXtart (Open, ReadLine, and Close) process small configuration files. They are not intended for larger operations, such as scanning long files. For the sake of simplicity and speed, Open reads an entire ASCII file into memory, and subsequent ReadLine commands read lines stored in memory.
READPROFILESTRING/WRITEPROFILESTRING use the internal Windows API to read/write whereas your solution will do it in KiXtart , which is very inefficient compared to a C++ API.

Also, I would say the READPROFILESTRING/WRITEPROFILESTRING will use less packets to accomplish a give task than the
OPEN/READLINE/WRITELINE/CLOSE.
_________________________
There are two types of vessels, submarines and targets.

Top
#42276 - 2003-06-30 09:53 PM Re: Multiple WriteProfileString() ?
Austin Offline
Seasoned Scripter

Registered: 2002-01-24
Posts: 439
Got it.. my solution is to combine my entries into one value.. I will split them out on the other end.. when I am processing the ini file.

Thank you
_________________________
Austin Henderson

Top
#42277 - 2003-06-30 10:00 PM Re: Multiple WriteProfileString() ?
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Now, how much time does the pre-/post-processing of your conbined value take in comparison to the four separate WRITEPROFILESTRINGs?

If you try so hard to optimize your code then I'm curious which of the two approaches is actuallay the faster one, both in terms of CPU-cycles/execution-time and number of packets send over the network.
_________________________
There are two types of vessels, submarines and targets.

Top
#42278 - 2003-06-30 10:05 PM Re: Multiple WriteProfileString() ?
Austin Offline
Seasoned Scripter

Registered: 2002-01-24
Posts: 439
I am not sure as of yet to be honest with you. I will get back with you on that.
_________________________
Austin Henderson

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1160 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.219 seconds in which 0.193 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org