Best wishes, Leon !
LV> I have a string:
LV> "a:\cpp\filename.cdm" and I want to change its file extension
LV> so it reads "a:\cpp\filename.trk"
Use simply circle (such us _while_) and scan your string for a point.
If you'll find point - change last three symbols, if not - add point, three
symbols of extantion and /0 symb. at the and of string.
char my_string[100];
// There must be functions getting sourse string...
int i=0;
while (my_string[i] != 0 || my_string[i] != '.')
{
i++;
}
if (my_string[i] == '.')
{
i++;
my_string[i] = 't';
i++;
my_string[i] = 'r';
i++;
my_string[i] = 'k';
i++;
my_string[i] = \0; // This is needed if your sourse extension contains
only // two or one symbs.
}
if(my_string[i] == \0)
{
// Same, but add a point character
};
ATTANTION: it will not work if any directory from path have extention.
Hiding in the grave
Anton S. Maximenko
--- GoldED/386 2.50+
---------------
* Origin: Night is so beautiful (we need her as we need Day) (2:5020/535.29)
|