rabanes@uhccux.uhcc.Hawaii.Edu (Greg Rabanes) (08/24/90)
I am currently tying to write a journaling device driver and am having a few problems with it. The programming environment I am using is MPW and the language is MPW C. 1) When creating the file from within the driver's "open" routine I am using the File manager routine "create" (NOTE: the lower case version included in the MPW C header file <Files.h>). My code goes as follows: char fname[255] = "dezaley:user:journal4.dat"; create(fname, vrefnum, fcreator, ftype); Now the problem. A file is being created but not with the name or the directory I specified. I get a file named some- thing like &*&%&$^%@#% on the default volume. Now when I use these same declarations and calls from a plain old C program, it works fine. So, is there a way around this or am I doing something wrong? 2.) Although I have the above problem, a file is created and ultimately written to by my journaling device driver. I believe that the data written to the file is in compliance with what is specified in IM I-261. That is, I am writting both the Journal Code and the results of the call to the par- ticular Event manager routine making the call. A separate program I have written verifies this. (I think?!) Anyway, if my above belief is true then how do I go about playing back the recorded events? According to IM, I must set the system global variable JournalFlag to a negative number to tell the Event Manager that I am playing back a journal. There must be more to it than that? Do I write another driver that does the playback? If I do, then how does the Event Manager decode the file I have recorded the journal to? 3.) Next is the matter of finding some documentation on journaling. I have looked through the Macintosh Technical Notes as well as the Inside Macintosh series but I could not find much on this subject. Are there any books or articles which address this subject? As you can see by now I am quite lost and any help would be greatly appreciated. Mahalo (hawaiian for thanks) Mike Kanada c/o rabanes@uhccux.uhcc.hawaii.edu
nmday@apple.com (Neil) (08/25/90)
In article <9109@uhccux.uhcc.Hawaii.Edu> rabanes@uhccux.uhcc.Hawaii.Edu (Greg Rabanes) writes: > 1) When creating the file from within the driver's "open" > routine I am using the File manager routine "create" (NOTE: > the lower case version included in the MPW C header file > <Files.h>). My code goes as follows: > > char fname[255] = "dezaley:user:journal4.dat"; > > create(fname, vrefnum, fcreator, ftype); > > Now the problem. A file is being created but not with the > name or the directory I specified. I get a file named some- > thing like &*&%&$^%@#% on the default volume. One possible source of error is that the toolbox expects a Pascal string. your declaration should read : char fname[255] = "\pdezaley:user:journal4.dat"; Also, I've encountered cases where MPW dosen't like references to char arrays of the form Somecall(fname) where fname is declared as above. Even though it's kinda' ugly, Somecall (&fname[0]) seems safer. If you're going to be creating files that stick around it's generally better to use a SFPutFile, rather than hard-wiring it into your code. Another alternative is to put your journal files into the blessed folder - See Tech Notes #67 and #129 for an in depth discussion... Neil Day Apple Computer, Inc. Electronic Media Group The oppinions presented above are my own - any resemblance to those of Apple Computer are purely coincidental.
russotto@eng.umd.edu (Matthew T. Russotto) (08/28/90)
In article <9926@goofy.Apple.COM> nmday@apple.com (Neil) writes: >In article <9109@uhccux.uhcc.Hawaii.Edu> rabanes@uhccux.uhcc.Hawaii.Edu >(Greg Rabanes) writes: > >One possible source of error is that the toolbox expects a Pascal string. >your declaration should read : > char fname[255] = "\pdezaley:user:journal4.dat"; Make that 'char fname[256] = ...' MPW (2.02 at least) will not word-align character arrays following other character arrays, so something like char foo[255]; char bar[26]; can cause some real bizarre address errors if you ever try to do a word-length access to bar. -- Matthew T. Russotto russotto@eng.umd.edu russotto@wam.umd.edu ][, ][+, ///, ///+, //e, //c, IIGS, //c+ --- Any questions?