Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Bleakcabal

Copying Strings

This topic is 6388 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Does anyone know how to copy the characters say from 44 to 66 in source string to destination string ? strncpy starts at the start of the string I have checked there is a function called _strninc but the compiler doesn''t seem to reconize it, I include tchar.h and string.h and tried it without the leading underscore. This function though is only supposed to advance the character pointed at, but that would have served my purpose. WHO DO THEY THINK THEY''RE FOOLING : YOU ?
GARAL website

Share this post


Link to post
Share on other sites
Advertisement
int start_offset = 44;
int end_offset = 66;
char source_string[81];
char dest_string[81];
/* fill source_string with character data or whatever */
strncpy(dest_string, &source_string[start_offset], end_offset-start_offset+1);

/* or do it this way */
strncpy(dest_string, source_string+start_offset, end_offset-start_offset+1);


Edited by - Mongo on February 16, 2001 11:34:13 AM

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!