[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] File reading ?'s



on 6/10/98 10:12 PM , Vicki Brown  wrote:

>> >From "Perl 5 for Dummies":
>>
>> "read(HANDLE, VARIABLE, LENGTH, POSITION);
>>
>> The Variable is the place where you want to read into, the length is the
>> number of bytes to read, and the position is the byte in the file to
>> start reading from."
>>
>> it says that if you leave the Position empty, then it uses the current
>> file position, but if you put a number there, that is the starting point.
>>  Is this totally wrong?
>
>Youch.  Close enough to confuse.  According to the POD (or the Camel, take
>your pick)  OFFSET (aka POSITION) isn't the position in the file to start
>reading from, it's the position in the scalar to read _to_.  A subtle
>difference but a major one!

Yeah.  That's where I went wrong all right.  I found the POD document 
later.  Thanks.

I was trying to use the Mac::Resources package.  I told it to do this:

($file = &MacPerl::Choose(&GUSI'AF_FILE,0,"File 1")) or die;
	
$sp = FSpOpenResFile($file);


and got the error message:

# Usage: Mac::Resources::FSpOpenResFile(spec, permission).

The documentation tells me:

---------
FSpOpenResFile SPEC, PERMISSION	

The FSpOpenResFile function opens the resource fork of the file 
identified by 
the spec parameter. It also makes this file the current resource file.

    $sp = FSpOpenResFile($SPEC);
    if ( defined $sp ) {
      # proceed
    }

In addition to opening the resource fork for the file with 
the specified name, FSpOpenResFile lets you specify in the 
permission parameter the read/write permission of the resource fork 
the first time it is opened. 
------------

So.  Is this what I want to be using to access a resource fork?  Am I 
misreading the documentation again?

Thanks all for your great list.

Jeremy

Jeremy Lee                     |   Owner- 
Sound Designer/Technician      |   Madrone Ridge Sound Design
Oregon Shakespeare Festival    |   Sound for Multimedia
                               |
                 http://www.ashland.net/madrone
-------------------------------------------------------------------------
"Is it not strange that sheeps' guts should hale souls out of men's 
bodies?"  
        -  Wm. Shakespeare

"The mime sang:"  - Alfred Jarry
------------------------


***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch