Advertisement Jump to content


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


Copying Strings

This topic is 6546 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
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, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!