Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Extract substring from a certain position 1

Status
Not open for further replies.

sunaj

Technical User
Feb 13, 2001
1,474
DK
Hi,

How do I extract a substring from a certain position?

Example:
------------------------------------------------
char MyStr[255];
char MySubStr[10];

MyStr = "Hello hello, this is a test text to extract a substring from.";
-------------------------------------------------
Now I want to set MySubStr to the string that starts at position 14 and is 10 characters long (='this is a ').

Thanks,
Sunaj
 
strncpy(MySubStr,MyStr+13,9); John Fill
1c.bmp


ivfmd@mail.md
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top