Register forum user name Search FAQ

Gammon Forum

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 ➜ viewskills snippet

viewskills snippet

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Ithildin   USA  (262 posts)  Bio
Date Sat 06 Dec 2003 04:05 AM (UTC)
Message
Ok, i'm putting in samsons viewskill. i put in all the code and everything else i have to do and i get a warning.

warning C4013: 'snprintf' undefined; assuming extern returning int

snprintf( buf, MAX_STRING_LENGTH, "%20s %3d%% ", skill_table[sn]->name,

that's the line of code. i'm also getting

skills.obj : error LNK2001: unresolved external symbol _snprintf
C:\Documents and Settings\TYLER\Desktop\smaug\Mud\smaug\smaug.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.


what's the snprintf mean?
Top

Posted by Ithildin   USA  (262 posts)  Bio
Date Reply #1 on Sat 06 Dec 2003 05:26 AM (UTC)
Message
i kinda figured it out, but what i did was take out max string length in the code and just sprintf and it worked fine.

i'm thinking that snprintf means that it will cut off if it is too long or something?

anyone know?
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #2 on Sat 06 Dec 2003 07:17 AM (UTC)

Amended on Sat 06 Dec 2003 07:18 AM (UTC) by David Haley

Message
What compiler are you using? According to the MSDN, snprintf is in "All version of the C runtime libraries". However, that's for MSVC... and it doesn't look like you're using that.

Edited to add:
Oh, and here's what snprintf does... (taken from the MSDN help page)

Quote:

int _snprintf(
   char *buffer,
   size_t count,
   const char *format [,
   argument] ... 
);

The _snprintf function formats and stores count or fewer characters and values (including a terminating null character that is always appended unless count is zero or the formatted string length is greater than or equal to count characters) in buffer. Each argument (if any) is converted and output according to the corresponding format specification in format. The format consists of ordinary characters and has the same form and function as the format argument for printf. If copying occurs between strings that overlap, the behavior is undefined.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Ithildin   USA  (262 posts)  Bio
Date Reply #3 on Sat 06 Dec 2003 07:42 AM (UTC)
Message
i'm using MVC++ 6.0
and it has like vsnprintf and so on. but i just used sprintf and i think i'm content with that. thanks though for helping.
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.


14,387 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.