View Single Post
Re: Any of you string/pointer/memory guru's out there who can help me?
Old
  (#3)
@$3.1415rin
Council Member, Author of JoeBOT
 
@$3.1415rin's Avatar
 
Status: Offline
Posts: 1,381
Join Date: Nov 2003
Location: Germany
Default Re: Any of you string/pointer/memory guru's out there who can help me? - 09-04-2004

do you think everybody reads all this code ?

well, some functions which should be used and might be helpful. if you wanna get practice in coding such stuff nothing is against implementing it yourself, but 'inlining' it all the time looks a bit bad :
  • memset(destination, byte, size); // sets some piece of memory to some value
  • strcpy(destination, source ); // copies source to destination. notice that the source string should be small enough to fit in destination, and that source is terminated by a zero
  • strncpy(destination, source, size); // copies just size bytes from source to destination
  • strcat(destination, source ); // append source to destination. all this stuff is about zero terminated strings. ( the sz in hungarian notation
  • strcmp(sz1, sz2 ); // compares 2 strings. zero if equal, otherwise -1 or 1
  • sprintf ... // the same like with printf, but to memory. and keep in mind the % stuff ... %s for string, %c for char, %i for int etc.
dunno how much interesting function I forgot which you'd need. also useful might be the string class ( is that a part of STL or where does that come from ) from <string>


  
Reply With Quote