
Untitled
By: a guest on
Jul 20th, 2012 | syntax:
None | size: 0.47 KB | hits: 10 | expires: Never
Splitting string with token
sscanf(mat, "%s.txt", ime_datoteke);
sscanf(mat, "%[^.].txt", ime_datoteke);
char* dot = strrchr(mat, '.');
strncpy(ime_datoteke, mat, dot - mat);
char* pch = strrchr(str,'.');
if(pch)
*pch = ' ';
const char *fullstop;
if ((fullstop = strrchr(mat, '.')))
strncpy(ime_datoteke, mat, fullstop - mat);
else
strcpy(ime_datoteke, mat);
char a[] ="sm04567890.txt";
char *b = strstr(a, ".txt");
*b = ' ';
printf("%sn", a);