Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Any System Calls works like WritePrivateProfilestring?

136 views
Skip to first unread message

Andrew Veliath

unread,
May 6, 1997, 3:00:00 AM5/6/97
to supe...@planet.net.hk

>>>>> On the day of Wed, 07 May 1997 00:39:34 +0800,
>>>>> Raymond Li Cheuk Fai said:

Raymond> Hello, I want to do some 'simple' file handling, like
Raymond> writing a list of values into a file. I wish to be able
Raymond> to retrieve them easily (with only one or two functions,
Raymond> hopefully). The amount of data are less then couples of
Raymond> words.

Raymond> I really have no particular requirement on the
Raymond> file format. But one idea I have is to store the values
Raymond> in the format like ini file in Microsoft Windows, or in
Raymond> the format like Unix '.profile' file.

If you use X/Windows, you might use the X resource manager since you
can read and write XrmDatabases with it. You will have to do slightly
more than those Windows calls, however. See the man page for
functions like XrmGetFileDatabase, XrmPutFileDatabase, etc. for more
information.

Andrew

Raymond Li Cheuk Fai

unread,
May 7, 1997, 3:00:00 AM5/7/97
to

Hello,
I want to do some 'simple' file handling, like writing a list of
values
into a file. I wish to be able to retrieve them easily (with only one or
two functions, hopefully). The amount of data are less then couples of
words.

I really have no particular requirement on the file format. But
one
idea I have is to store the values in the format like ini file in
Microsoft Windows, or in the format like Unix '.profile' file.

Are there any functions in Unix ( or particularly, Linux, which
I am
using ) that is handy to use, which works like Getprivateprofilestring
and writeprivateprofilestring ( may be mis-spelled, sorry ) in Windows?

Otherwise, do anyone have other approach to store and retreive
small amount of data easily?

Thanks for your help!
--
Raymond Li, supe...@planet.net.hk
http://www.planet.net.hk

Boyd Roberts

unread,
May 7, 1997, 3:00:00 AM5/7/97
to

Fortunately UNIX has not been poluted, yet, by such monstrosities.

You will most probably have to roll you own, although it depends
what you want to do. Perhaps there is a better way, but you have
not revealed what you are trying to do.

--
Boyd Roberts <bo...@france3.fr> N 31 447109 5411310

``Not only is UNIX dead, it's starting to smell really bad.'' -- rob

Uwe Bonnes

unread,
May 7, 1997, 3:00:00 AM5/7/97
to

In comp.os.linux.development.system Raymond Li Cheuk Fai <supe...@planet.net.hk> wrote:
: Hello,

: I want to do some 'simple' file handling, like writing a list of
: values
: into a file. I wish to be able to retrieve them easily (with only one or
: two functions, hopefully). The amount of data are less then couples of
: words.

...

: Are there any functions in Unix ( or particularly, Linux, which


: I am
: using ) that is handy to use, which works like Getprivateprofilestring
: and writeprivateprofilestring ( may be mis-spelled, sorry ) in Windows?


You could have a look at the implementation of Getprivateprofilestring etc
in the window emulator Wine.
--
Uwe Bonnes b...@elektron.ikp.physik.th-darmstadt.de

Institut fuer Kernphysik Schlossgartenstrasse 9 64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------

James Youngman

unread,
May 7, 1997, 3:00:00 AM5/7/97
to

In article <336F5E...@planet.net.hk>, supe...@planet.net.hk says...

> Are there any functions in Unix ( or particularly, Linux, which
>I am
>using ) that is handy to use, which works like Getprivateprofilestring
>and writeprivateprofilestring ( may be mis-spelled, sorry ) in Windows?

A portable version was published in Doctor Dobbs Journal in about 1993, give or
take a year or two. Failing that, use fprintf()...

--
James Youngman VG Gas Analysis Systems The trouble with the rat-race
Before sending advertising material, read is, even if you win, you're
http://www.law.cornell.edu/uscode/47/227.html still a rat.


John Kodis

unread,
May 7, 1997, 3:00:00 AM5/7/97
to

Previously, Raymond Li Cheuk Fai wrote:

> I want to do some 'simple' file handling, like writing a list of
> values into a file. I wish to be able to retrieve them easily (with
> only one or two functions, hopefully). The amount of data are less
> then couples of words.

Try `fprintf' to write things out, and `fscanf' to read things back
in. These are much more versitile than WritePrivateProfilestring, and
their names are much more legible as well. Hope this helps.

-- John Kodis.


Paul David Fox

unread,
May 13, 1997, 3:00:00 AM5/13/97
to

Andrew Veliath wrote:
> If you use X/Windows, you might use the X resource manager since you
> can read and write XrmDatabases with it. You will have to do slightly
> more than those Windows calls, however. See the man page for
> functions like XrmGetFileDatabase, XrmPutFileDatabase, etc. for more
> information.
>
> Andrew


Dont under any circumstances use the Xrm garbage. You will not
only confuse yourself, you will confuse the user. (Reason: which
resource actually takes effect - it could be in the fallback resources,
the app resources in /usr/lib/X11, ~/<App-name>, on the command
line, etc etc).

Do the one and only one good thing Microsoft came up with - use
a .ini file (otherwise known as an .rc file under Unix).

______________________________________________________________________
| Paul David Fox Lehman Brothers. |
| Consulant E-mail: NOSPAM_pfox@NOSPAM_lehman.com |
| #### Sold! ########### Home: NOSPAM_fox@NOSPAM_crisp.demon.co.uk |
| ###################### Tel: +44 171 601 0011 x6025 |
This message is

Erik Schnetter

unread,
May 15, 1997, 3:00:00 AM5/15/97
to

Paul David Fox (pfoxS...@lehman.com) wrote:

: Andrew Veliath wrote:
: > If you use X/Windows, you might use the X resource manager since you
: > can read and write XrmDatabases with it. You will have to do slightly
: > more than those Windows calls, however. See the man page for
: > functions like XrmGetFileDatabase, XrmPutFileDatabase, etc. for more
: > information.
: >
: > Andrew


: Dont under any circumstances use the Xrm garbage. You will not
: only confuse yourself, you will confuse the user. (Reason: which
: resource actually takes effect - it could be in the fallback resources,
: the app resources in /usr/lib/X11, ~/<App-name>, on the command
: line, etc etc).

: Do the one and only one good thing Microsoft came up with - use
: a .ini file (otherwise known as an .rc file under Unix).

I am not sure whether you meant this is an ironic way, but...

...with your method, you will have the same problems: on a Unix
system, there should be

1. a system default, set up by the manager, to reflect the overall
system configuration ("which devices are available?")

2. a per user default (because users want to set up things their own
way)

3. a compiled-in default (so that the program doesn't need to crash if
there's no .ini/.rc file -- important the first time it is started)

4. and, last but not least, a method to override these values on the
command line (to "try" things just once, on the fly).

Which is exactly what Xrm gives you. Don't forget the Windows usually
doesn't have several users (hence no per user setup) and no command
lines (which might come in handy in certain situations).

As I said, I'm not sure whether you've been ironic.

-erik

-----
Erik Schnetter, erik.sc...@student.uni-tuebingen.de

Arthur C. Clarke saw the future.
He knew it would be run by huge computers.
And he was right. Just not about the size.

Albert D. Cahalan

unread,
May 15, 1997, 3:00:00 AM5/15/97
to

zxm...@hp07.zdv.uni-tuebingen.de (Erik Schnetter) writes:
> Paul David Fox (pfoxS...@lehman.com) wrote:

>> Dont under any circumstances use the Xrm garbage. You will not
>> only confuse yourself, you will confuse the user. (Reason: which
>> resource actually takes effect - it could be in the fallback resources,
>> the app resources in /usr/lib/X11, ~/<App-name>, on the command
>> line, etc etc).
>>
>> Do the one and only one good thing Microsoft came up with - use
>> a .ini file (otherwise known as an .rc file under Unix).
>
> I am not sure whether you meant this is an ironic way, but...

No, he is right.

> ...with your method, you will have the same problems: on a Unix
> system, there should be
>
> 1. a system default, set up by the manager, to reflect the overall
> system configuration ("which devices are available?")
>
> 2. a per user default (because users want to set up things
> their own way)
>
> 3. a compiled-in default (so that the program doesn't need to crash if
> there's no .ini/.rc file -- important the first time it is started)
>
> 4. and, last but not least, a method to override these values on the
> command line (to "try" things just once, on the fly).
>
> Which is exactly what Xrm gives you. Don't forget the Windows
> usually doesn't have several users (hence no per user setup)
> and no command lines (which might come in handy in certain
> situations).

Actually it does support multiple consecutive users. For this,
consecutive/concurrent makes no difference. It also lets you
launch GUI apps from the command line.

The X way is broken. Oh, what I'd do to have MS port Windows
to run on the Linux kernel. I'll get my asbestos underwear now.
--
--
Albert Cahalan <acahalan at cs.uml.edu> My address may be mangled to
avoid junk email. Please check it if you wish to respond to a news post.

Christian D. Smith

unread,
May 16, 1997, 3:00:00 AM5/16/97
to

In article <vc7pvus...@mercury.cs.uml.edu>,
Wine is on it's way :-)

Are you sick, or something (meant in the nicest possible way)?

If MS port Windblows to Linux, then all that shit Window$ software
will flood the Linux. With Wine, we will have a way of running
legacy apps, but they really need rewriting anyway because WinXX is
a broken API.

My 2 cents.

Christian

Don Read

unread,
May 17, 1997, 3:00:00 AM5/17/97
to

During a brain fsck on 15 May 1997 13:09:13 -0400, Albert D. Cahalan
<no_junk_m...@mercury.cs.uml.edu> proclaimed ...

>
>
> Oh, what I'd do to have MS port Windows
>to run on the Linux kernel. I'll get my asbestos underwear now.
>--

And probably another 32Meg of memory befor it will run ...

--
Don Read sy...@calcasieu.com
EDP Manager dr...@texas.net
Calcasieu Lumber Co. Austin TX
-- If NT is the answer, You don't understand the question


Vladislav Papayan

unread,
May 18, 1997, 3:00:00 AM5/18/97
to

In article <slrn5n247i...@kodis.jagunet.com>, ko...@jagunet.com says...
Take a look at C/C++ code snippets
http://www.strangecreations.com/strange/library/snippets/snippets.htm
One source file implements what you want cross-platform. To find what
source code file that is look at something.NDX file.


Vladislav


0 new messages