🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.mac.programmer.help
Article #13

Re: Can an OSType be interchanged with a Str255? How?

#13
From: F. Degott
Date: Mon, 21 Aug 1995 11:50
41 lines
1720 bytes
In article <oylerb-2108950006040001@msp1-5.nas.mr.net>,
oylerb@tdkt.skypoint.net (Bill A. Oyler) wrote:

>Hello,
>
>This should be a simple question.  I need to change the creator of a file
>by using the SetFInfo toolbox call.  The creator is stored in a Str255,
>however, not in an OSType like the call requires.
>
>How can I convert a Str255 to an OSType?  I tried some different methods
>of typecasting, but can't get anything to work.  Help!  :)
>

Hi Bill,

an OSType is a char array of size 4 (with offset 1).

file manager declaration:

type OSType = PACKED ARRAY [1..4] OF CHAR;

convertion: Str255 to OsType 

var
      Str: Str255;
      OsT: OSType;
      i,l: integer;

Str:='TEXT';{something describing an OSType}
{convertion: Str255 -> OsType}
for i:=1 to 4 do OsT[i]:=' ';{init. OsT with space}
l:=lenght(Str);
if l>4 then l:=4;
for i:=1 to l do OsT[i]:=Str[i]; {copying str to OsT}

Hope this helps.
Fr
-------------------------------------------------------------------------
FR Degott (Francois-Regis.Degott@imag.fr)
Lab. LMC-IMAG - UJF - Grenoble - France
-------------------------------------------------------------------------
Technical Details
Message-ID: <Francois-Regis.Degott-2108951354510001@harpie.imag.fr>
Path: arc1-ca.pugleaf.net!harpie.imag.fr!user
References: <oylerb-2108950006040001@msp1-5.nas.mr.net>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!harpie.imag.fr!user
From: Francois-Regis.Degott@imag.fr (F. Degott)
Newsgroups: comp.sys.mac.programmer.help,comp.lang.c
Subject: Re: Can an OSType be interchanged with a Str255?  How?
Date: 21 Aug 1995 11:50:54 GMT
Organization: LMC-IMAG Grenoble France
Message-ID: <Francois-Regis.Degott-2108951354510001@harpie.imag.fr>
References: <oylerb-2108950006040001@msp1-5.nas.mr.net>
NNTP-Posting-Host: harpie.imag.fr
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 8bit