Path: utzoo!attcan!uunet!know!samsung!uakari.primate.wisc.edu!uflorida!haven!ncifcrf!lhc!mimsy!mojo!russotto From: russotto@eng.umd.edu (Matthew T. Russotto) Newsgroups: comp.sys.mac.programmer Subject: Re: ThinkC prototypes and Str255 args Message-ID: <1990Sep17.172732.23339@eng.umd.edu> Date: 17 Sep 90 17:27:32 GMT References: <1990Sep15.154434.17307@midway.uchicago.edu> <4449@sage.cc.purdue.edu> Sender: news@eng.umd.edu (The News System) Organization: College of Engineering, Maryversity of Uniland, College Park Lines: 20 In article <4449@sage.cc.purdue.edu> ar4@sage.cc.purdue.edu (Piper Keairnes) writes: >fri0@quads.uchicago.edu (Christian E. Fritze) writes: >>I'd like to be able to call functions which expect arguments of the type Str255 >>with a string I build on the fly. If I try to pass a string to a function like >>SomeFunction("\pHere's my string"); > >There is one problem... C passes arguments by value. So, when you make a >call to some procedure that expects a Str255, it is expecting the entire >string array. When you make a call such as the one above, C is simply >passing a pointer to that string. If Str255 is defined as a struct, this is true. However, in most C's, Str255 is defined as an array (I believe MPW 2.0.x is the only exception), and any function which accepts a parameter of type Str255 expects a pointer to the string. flames | the guy responsible for MPW 2.0 struct Str255s. -- Matthew T. Russotto russotto@eng.umd.edu russotto@wam.umd.edu .sig under construction, like the rest of this campus.