Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ SMAUG
➜ SMAUG coding
➜ wrighting a printf stament
|
wrighting a printf stament
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Proto-6
Canada (26 posts) Bio
|
| Date
| Fri 14 Mar 2003 09:50 PM (UTC) Amended on Fri 14 Mar 2003 10:25 PM (UTC) by Proto-6
|
| Message
| ok i've been trying to install a a printf statment sot get a %LF to worke and what im wundering is that do I need to put it in a spacifick area or can it fit any where in the code just floting in some random string
allso could I get a exampol of what one would look like I dont need a real on a fake one would do I just want to compar it too mine to see if I did it right or not
thanx :]
P.S. I have never writen one in my life so this is verry new to me I hope this isent too stuped of a question | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #1 on Fri 14 Mar 2003 09:59 PM (UTC) |
| Message
| It is hard to give an example without knowing what you are trying to do. Perhaps post what you have done, and we can comment.
First, it is printf, not printif as you had in your post. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Proto-6
Canada (26 posts) Bio
|
| Date
| Reply #2 on Fri 14 Mar 2003 10:24 PM (UTC) |
| Message
| ooo ya sory i'v been working on not dooing that :) I hate making spelling mistakes any whay her is the printf statment I have
int sprintf(buf, "%lf", long double);
i just whant it to be abil to show long double's
allso as I sead dose it matter where it is put in the code or can it be on any lign I want it to be on | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #3 on Sat 15 Mar 2003 04:52 AM (UTC) Amended on Sat 15 Mar 2003 04:53 AM (UTC) by Nick Gammon
|
| Message
| It is hard to know where to start here. I suggest trying to learn C using a simpler program than a MUD server.
Major changes are required, something like this:
char buf [100];
double mynumber = 22.5;
sprintf (buf, "%f", mynumber);
Quote:
do I need to put it in a spacifick area or can it fit any where in the code just floting in some random string
The nature of programming is such that the order of things is important. You put the line in the part of the code where you want the number to be converted to a string.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Proto-6
Canada (26 posts) Bio
|
| Date
| Reply #4 on Sat 15 Mar 2003 07:48 AM (UTC) |
| Message
| | hay thanx this will help alot and I agree unfortunitly I have a one track minde and once I start somthing I cant stop ( I dident want to do the mud thing first my mom convinced me to and then I went all gung ho) but Ill try to do a simpole program if I get time and ill allso look for a good book on c but now I know that I cant just put the code any where so thanx :) | | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
16,662 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top