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: <8190@oberon.USC.EDU> Date: 7 Apr 88 04:41:49 GMT References: <8804051628.AA27845@decwrl.dec.com| <3482@ece-csc.UUCP| Sender: news@oberon.USC.EDU Reply-To: papa@pollux.usc.edu (Marco Papa) Organization: Felsina Software, Los Angeles, CA Lines: 39 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) |so all you have to do to reset preferences is: | | open the intuition library | IntuitionBase = OpenLibrary("intuition.library",0); | open the disk file devs:system-configuration (or your substitute file) | 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") | issue a SetPrefs call (this is what makes it all work) | SetPrefs(&pref,sizeof(pref),TRUE); | close the library & file & exit. 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 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= uucp:...!pollux!papa BIX:papa ARPAnet:pollux!papa@oberon.usc.edu "There's Alpha, Beta, Gamma and Diga!" -- Leo Schwab [quoting Rick Unland] -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=