I have a string and I want its sub string from 5th location to last location. Which function should I use?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can use the
memcpy()function which is instring.hheader file.memcpy()copies bytes of data between memory blocks, sometimes called buffers. This function doesn’t care about the type of data being copied–it simply makes an exact byte-for-byte copy. The function prototype isThe arguments dest and src point to the destination and source memory blocks, respectively. count specifies the number of bytes to be copied. The return value is dest.
If the two blocks of memory overlap, the function might not operate properly — some of the data in src might be overwritten before being copied. Use the
memmove()function, discussed next, to handle overlapping memory blocks.memcpy()will be demonstrated in program below.You can also find an example for these function over here: http://www.java-samples.com/showtutorial.php?tutorialid=591