I have a situation where I need to take the first 4 characters of a string and change them. Let's say for instance I have these numbers stored in a string:
123456789
What I want to do is take the 1234 and change it to a 4321
N/M, that was really easy. But I have a related issue. I now need to do the same thing but with the last 4 characters of a string. For the problem mentioned above I just used strncpy, however that just does the first characters of size n. What if I want to do this with middle or end characters?
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.