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
  #4  
Old 06-09-2002, 05:33 AM
theCoder
Sarnak
 
Join Date: Jan 2002
Posts: 90
Default

man is a command you can use to find information about various things, from other commands to system calls and more. man is short for manual, but it's only available (AFAIK) on UNIX style systems (Linux, MacOSX, etc).

As far as finding the "00" in a null terminated string, you'll probably want to use strstr. strstr takes two parameters: the string to search and the string to search for. It returns a pointer to the position in the first string where the second string is located (or NULL if it's not found). For example:
Code:
char[256] name = "Some name00";
char* found = strstr(name, "na");
printf("%s\n", found);
Would print out "name00". In this case, found is actually equal to name+5 in terms of pointer math. It can get confusing if you don't understand how pointers work. I'd suggest you find some reference that explains pointers in c/c++.

To better answer your original question, however, if you wanted to delete the "00" in the name above, you would strstr for "00" and if it was found (return value is not NULL), then deference the pointer and set it to '\0' (the null character):
Code:
char* found = strstr(name, "00");
if (found != NULL) *found = '\0';
printf("%s\n", name);
Now it prints out "Some name".

Also, if you do change the data in the string, you should be sure to copy it first or it will change the data in the class (which you probably don't want )

HTH
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 11:29 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