Go Back   EQEmulator Home > EQEmulator Forums > Archives > Archive::Development > Archive::Development

Archive::Development Archive area for Development's posts that were moved here after an inactivity period of 90 days.

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 01-05-2003, 06:24 PM
mByte
Hill Giant
 
Join Date: Feb 2002
Posts: 206
Default strncpy question

I am working on a small side project for me to add npc's just by being in the world.

I am saving them to the database but now I want to remove the 000's

can somebody over look this code tell me what is wrong and someway to fix it.

Code:
void Database::SaveSpawn(const char* s1, int8 s2, int16 s3, int8 s4, sint32 s5, int8 s6, int8 s7, int8 s8, float s9, int8 s10)
{
	char errbuf[MYSQL_ERRMSG_SIZE];
	int snl = strlen(s1)-3;
	char snbuff[64];
	char *query = 0;
	int32 affected_rows = 0;
    MYSQL_RES *result;
    MYSQL_ROW row;

	if(strstr(s1, "00") != 0){
		strncpy(snbuff,s1,snl);
	}

	char* sqlQuery = "INSERT INTO npc_types (name, level, race, class, hp, gender, texture, helmtexture, size, social) values('%s','%i','%i','%i','%i','%i','%i','%i','%f','%i')";

	RunQuery(query, MakeAnyLenString(&query, sqlQuery, snbuff,s2,s3,s4,s5,s6,s7,s8,s9,s10));
	delete[] query;
}
npc name being passed is 'hot000'

It is removing the three 000's but replacing with this other crap any tips?
[code]
hot
__________________
mByte
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 02:51 AM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3