Reputation: 581
I am studying about string in C and I have this question . I've had a look at some question in stackoverflow but I cant find the same Question,if there is pls give me the link :D
For exp,I have a string "D://test.txt"
Now I want to convert it to "D://test1.txt"
I know that I have to find .
in the string,then put the number befor it,but I dont know how to do it. Pls help me out :(
Upvotes: 0
Views: 146
Reputation: 108986
Use strchr()
(or strrchr()
) to find the dot. Both functions have their prototype in <string.h>
.
There is no ready-made function for inserting a character in the middle of a string. You have to write your own.
Upvotes: 2