[futurebasic] Re: GetTypeAndCreator

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : June 2004 : Group Archive : Group : All Groups

From: Ken Shmidheiser <kshmidheiser@...>
Date: Sat, 12 Jun 2004 01:47:19 -0400
Michael Evans asked:

>This code is from Alain...
>
>I need the mirror of this, GetTypeAndCreator, as 
>so far my attempts have failed
>miserably....

... and here is the inverse function to set type and creator.

Ken

p.s. Watch for e-mail line breaks and lost constant underscores

/*

Carbon function to set file type and creator

    By Ken Shmidheiser
    Somerset, KY

    June 12, 2004

*/

local fn SetTypeAndCreator( fs as .FSSpec,¬
                         type as OSType,¬
                      creator as OSType )
'~'1
dim as OSErr   err
dim as FInfo @ info

info.fdType    = type
info.fdCreator = creator

err = fn FSpSetFInfo ( #fs, info )

end fn = err

dim as FSSpec fs
dim as OSErr  err

// Set a text file to BBEdit
long if len( files$( _FSSpecOpen, "", "", fs ) )
err = fn SetTypeAndCreator( fs, _"TEXT", _"R*ch" )
long if( err == _noErr )
print "File type and creator set"
xelse
print "Error No. "; err; " occurred"
end if
end if

include "Subs Quick Event Loop.Incl"