Given a string like "/documents/filename.txt", I need to produce a new string "/documents/filename_out.txt", where the new string simply appends _out to the filename, while preserving the .txt suffix.
#include <stdio.h>
#include <string.h>
int main(){;
char fileName[80];
printf("Please enter filename: ");
scanf("%s", fileName);
char outName[];
printf("Outputname: %s\n", outName);
}
Is there a way to, say, remove the last 4 characters (.txt) from a string, then append the string with "_out.txt"?
thanks in advance!