viewskills snippet

Posted by Ithildin on Sat 06 Dec 2003 04:05 AM — 4 posts, 15,232 views.

USA #0
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?
USA #1
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?
USA #2
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.
Amended on Sat 06 Dec 2003 07:18 AM by David Haley
USA #3
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.