Link to home
Start Free TrialLog in
Avatar of sbartok
sbartok

asked on

Deleting data in a string using offset

I have a string and a offset for that string, e.g.
string : “c:\dir1\dir2\file.ext”
offset : 13
and now i want to delete everything which is left from the offset. that only file.ext stays.
how can i do that ???
ASKER CERTIFIED SOLUTION
Avatar of nietod
nietod

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of nietod
nietod

Note technically this has a problem.  The two strings specified to strcpy should not overlap.  But it shouldn't be a problem when shifting forwards.  When shifting backwards it could be a problem.  You can use memmove() or a seperate string buffer if you want to be really safe.