Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #define N 256
- /*
- Hello.txt - > Hello.xyz
- */
- void renameTypeFile(char src[], char dest[], char *needle, char *text){
- int c = strcspn(src, needle);
- strncpy(dest, src, c);
- strcat(dest, text);
- }
- int main(int argc, char **argv)
- {
- char str[] = "Hello.txt";
- char str2[N] = {'\0'};
- renameTypeFile(str, str2, ".", ".xyz");
- printf("%s", str2);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement