Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
auth_update crash
Dec 23, 2017, 10:15 pm
By Remcon
check_tumble
Dec 18, 2017, 7:21 pm
By Remcon
parse description bug
Dec 15, 2017, 10:08 pm
By Remcon
Couple bugs
Dec 12, 2017, 5:42 pm
By Remcon
Bug in disarm( )
Nov 12, 2017, 6:54 pm
By GatewaySysop
LoP 1.46
Author: Remcon
Submitted by: Remcon
LOP 1.45
Author: Remcon
Submitted by: Remcon
LOP Heroes Edition
Author: Vladaar
Submitted by: Vladaar
Heroes sound extras
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.3
Author: Vladaar
Submitted by: Vladaar
Users Online
CommonCrawl, Yandex, Bing

Members: 0
Guests: 15
Stats
Files
Topics
Posts
Members
Newest Member
478
3,708
19,242
613
bastian
Today's Birthdays
Evoru (32)
Related Links
» SmaugMuds.org » General » Coding » itoa
Forum Rules | Mark all | Recent Posts

itoa
< Newer Topic :: Older Topic > seems silly to me...

Pages:<< prev 1 next >>
Post is unread #1 Feb 5, 2004, 5:51 pm   Last edited Nov 24, 2007, 3:14 pm by Samson
Go to the top of the page
Go to the bottom of the page

cynshard

GroupMembers
Posts95
JoinedNov 19, 2003

I'm writing a little procedure that will allow gods to go to a zone by typing gozone . I am checking the argument against all the current areas (A LA Foldarea). if the argument matches an area name i then call do_goto and send the char to the low_vnum of that area. In order to do this though, low_vnum needs to be a string to work with do_goto. At first I thought I'd just do this
do_goto( ch, buf = itoa(argument, buf, 10) ). I received the classic "function undefined error". I thought that was strange since other procedures in build.c use atoi, so i incluede stdlib.h and I'm getting the same error. Maybe I'm missing some cygwin packages, although I'm pretty sure I grabbed them all. I'm sitting at work so I can't try this just yet, I think I'll try this:
char *buf;
sprintf(buf, "%d", tarea->low_vnum);
do_goto(ch,buf);

I'm not too sure on the syntax of the sprintf function, but I don't see why that wouldn't work.
Ok, I'm done thinking out loud.
       
Post is unread #2 Feb 5, 2004, 7:37 pm
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,639
JoinedJan 1, 2002

First off, there is no itoa in the standard libraries. Yes, it seems illogical to me as well, but hey. I didn't write the things

As for why your solution failed, you need to change char *buf; to this:

char buf[MAX_INPUT_LENGTH];
       
Pages:<< prev 1 next >>