Path: utzoo!mnetor!uunet!lll-winken!lll-tis!ames!ll-xn!oberon!pollux.usc.edu!papa From: papa@pollux.usc.edu (Marco Papa) Newsgroups: comp.sys.amiga Subject: Re: calling all gurus Message-ID: <8214@oberon.USC.EDU> Date: 8 Apr 88 04:21:05 GMT References: <8804051628.AA27845@decwrl.dec.com| <3482@ece-csc.UUCP| <8190@oberon.USC.EDU| <3484@ece-csc.UUCP| Sender: news@oberon.USC.EDU Reply-To: papa@pollux.usc.edu (Marco Papa) Organization: Felsina Software, Los Angeles, CA Lines: 47 In article <3484@ece-csc.UUCP| rss@ece-csc.UUCP (Ralph Scherp) writes: |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)); |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. |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. I misunderstood your problem, since you were using the "standard" configuration file. If what you want is read the "preferences" from a "user" file you'll need a requester that asks for the filename. Your problem will be that if the file does NOT contain preferences data, but other stuff, you'll definitely GURU the machine. You'll have to do a lot of checking to ensure that ALL values are within appropriate ranges, BEFORE you do the SetPrefs. This will require a little more work than what you described. -- Marco -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= uucp:...!pollux!papa BIX:papa ARPAnet:pollux!papa@oberon.usc.edu "There's Alpha, Beta, Gamma and Diga!" -- Leo Schwab [quoting Rick Unland] -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=