I am trying to delete .txt extension from filename that is written in string “mat”:
sscanf(mat, "%s.txt", ime_datoteke);
If mat="sm04567890.txt" I want that ime_datoteke="sm04567890".
As in example I tried using sscanf, but it doesnt work (it copies mat to ime_datoteke).
How can I do it in C?
You could modify your
sscanfapproach slightly to read a string that does not include a.:However, it would be best if you look for the
.character from the end of the string, and then copy the substring determined by it.