home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!ferkel.ucsb.edu!taco!rock!concert!duke!news.duke.edu!hurston.zoo.duke.edu!user
- From: ksuiter@acpub.duke.edu (Karl A. Suiter)
- Newsgroups: comp.sys.mac.programmer
- Subject: SANE num2str problem
- Message-ID: <ksuiter-250193114015@hurston.zoo.duke.edu>
- Date: 25 Jan 93 16:46:40 GMT
- Sender: news@news.duke.edu
- Followup-To: comp.sys.mac.programmer
- Organization: Duke University
- Lines: 52
- Nntp-Posting-Host: hurston.zoo.duke.edu
-
- Hi,
-
- After dutifully searching through my copies of Inside Mac, Spinside Mac,
- Macintosh Programming Secrets, etc., I have to admit that I am stuck on
- this one (probably trivial) programming problem. It has to do with using
- the SANE num2str routine in Think C 5.04. The prototype for num2str is
- defined as
-
- void num2str(decform *, extended, void *);
-
- thus, I have the following snippet of code that should (I think) work
-
- void convertNum()
- {
- decform extStuff;
- Str255 tempStr;
- extended theNum;
-
- extStuff.style = FIXEDDECIMAL;
- extStuff.digits = 2;
- theNum = 1.00;
- num2str(&extStuff, theNum &tempStr);
- printf("%s", tempStr);
- }
-
- Well, when I try to compile this, I get the error message:
-
- "Illegal operation on struct"
-
- when if reaches the 'theNum = 1.00' line.
-
- The Think C manual states that extended values are actually doubles. So
- when I define the variable 'theNum' as double, I get the following error
- message:
-
- "Second arguement of function 'num2str' dows not match the prototype"
-
- when it tries to compile 'num2str(&extStuff, theNum &tempStr)'.
-
- What am I doing wrong? I'm sure this problem is easy to solve, but I'm
- stuck on it. Thanks in advance for any help.
-
- Karl
-
- ---
-
- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- | Karl A. Suiter, Duke University, Zoology Dept., Durham, NC 27706 |
- |=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=|
- | Voice: (919) 684-2251 | INTERNET: ksuiter@acpub.duke.edu |
- | FAX: (919) 684-6168 | COMPUSERV: 72701,3543@compserv.com |
- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-