Path: utzoo!mnetor!uunet!lll-winken!lll-tis!ames!umd5!uvaarpa!mcnc!ece-csc!rss From: rss@ece-csc.UUCP (Ralph Scherp) Newsgroups: comp.sys.amiga Subject: Re: calling all gurus Message-ID: <3484@ece-csc.UUCP> Date: 7 Apr 88 20:26:06 GMT References: <8804051628.AA27845@decwrl.dec.com| <3482@ece-csc.UUCP| <8190@oberon.USC.EDU> Reply-To: rss@ece-csc.UUCP (Ralph Scherp) Organization: North Carolina State University, Raleigh, NC Lines: 41 In article <8190@oberon.USC.EDU> papa@pollux.usc.edu (Marco Papa) writes: ]In article <3482@ece-csc.UUCP| rss@ece-csc.UUCP (Ralph Scherp) writes: ]|In article <8804051628.AA27845@decwrl.dec.com| kruger@16bits.dec.comh writes: ]||I am just starting to get involved with machine specifics of the Amiga, and ]||also suffer from extreme lack of time. However, the system is screaming for ]||a program that will set preferences from a file. ie: ]|| ]||setpref mypreferences ]||setpref yourpreferences ]|Sure, I've done this. It's quite simple. I wanted the same capability ][..deleted stuff] ]|The file "devs:system-configuration" is just an exact copy of the ]|"Preferences" structure defined in intuition/intuition.h (I think) [more deleted stuff] ]| fd = open("Devs:System-configuration",O_RDONLY,0); ] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ]| read the data into a struct Preferences ]| read(fd,&pref,sizeof(pref)); ] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ]| (where "pref" is "struct Preference pref") ]Please don't do that! What if C-A decides to change the filename or its ]location in a future release? There is an Intuition call that allows you ]to do just that in a portable way. It is called GetPrefs: ] ]GetPrefs(&pref, sizeof(pref)); > >Everything else is OK. > >-- Marco NO! Not if I read my intuition manual correctly. GetPrefs is documented as returning the CURRENT setting of preferences; which is not necessarily the same thing as that stored in the disk file devs:system-configuration. As I also stated, my program was a quick and dirty hack; a more sophisticated version would probably accept a filename as opposed to assuming DEVS:System-configuration; but regardless, fetching a permanent copy from disk is not the same as fetching something out of a RAM structure somewhere. Correct me if I'm wrong.... Mark Lanzo