home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.mac.programmer
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!hobbes.physics.uiowa.edu!news.iastate.edu!dunix.drake.edu!kjt001
- From: kjt001@dunix.drake.edu (Devil Bunny!)
- Subject: How to change an int to a string in Think C?
- Message-ID: <1993Jan23.191336.877@dunix.drake.edu>
- Organization: Drake University, Des Moines, Iowa, USA
- Date: Sat, 23 Jan 1993 19:13:36 GMT
- Lines: 38
-
- I'm working with Think C 4.0, and I need to display a number in a dialog
- with ParamText, but I don't know how to do it. If I use the following:
-
- ParamText("\p"+number,"","","");
-
- It gives me garbage instead of a number. So I figure I need to change
- the number to a text string first. I tried using sprintf to do this,
- but it seems to work incorrectly (gives me the wrong number) the first
- time, and then later, it gives me 'odd address' error when the following
- line is reached:
-
- thePart = FindWindow(gTheEvent.where, &whichWindow);
- switch(thePart)
-
- The sprintf line is written as follows:
-
- timeOfClick = (thisclick-lastclick);
- sprintf(textLine,"\p%d",timeOfClick);
- ParamText(textLine,"","","");
-
- with the following definitions:
-
- char *textLine;
- long int lastclick,thisclick,timeOfClick;
-
-
- Can anyone help me? Is there a better way to convert a number to text
- than sprintf? Or don't I need to?
-
-
- Thanks for any help!
-
-
- --
- | Kevin Tieskoetter kjt001@acad.drake.edu kjt001@dunix.drake.edu |
- | Drake University
- | Des Moines, IA...Where men are men, women are scarce, |
- | And sheep are nervous! |
-