I'm trying to make a function that turns a filename into a shorter name. For example "c:\windows\clouds.bmp" to "clouds". The problem comes at sname[s]=c; Does anyone know what the problem is? I have no idea. It doesn't give me a compliler error, but I get an assembly error (I use borland).
Code:
void ShortenFileName(char fname[0xff], char sname[0xff]) {
int f=0, s=0;
char c;
do {
c = fname[f];
if (c=='.' || c=='\0') {
sname[s]='\0';
return;
}
sname[s]=c;
s++;
if (c=='\\') {
s=0;
}
}
while(true);
}