Hey,
I'm trying to write a class to process strings. Here it is:
Code:
class FileBrowse
{
private:
static CString fpath;
public:
static CString GetFPath()
{
return fpath;
}
CString MakeName(CString rfname)
{
char temp[8];
int index, indexn, i, k=0;
CString nfname;
index = rfname.Find('/');
for(i=(index+1); i<(index+8); i++)
{
temp[k] = rfname[i];
k++;
}
temp[k] = '\0';
nfname = fpath;
indexn = nfname.ReverseFind(']');
nfname.SetAt(indexn, '.');
nfname = nfname + temp + ']';
return nfname;
}
};
CString FileBrowse::fpath = "recording:[000000]";
I call the methods in a loop in the main function where the class is instanciated, but at some point in the loop it stops working with an Access Violation error. I print them in an FTP file browsing loop:
Code:
while (bWorking)
{
bWorking = finder.FindNextFile();
rfname = finder.GetFilePath();
fprintf(out, ">%s<\n", rfname);
nfname = ConnectFile.MakeName(rfname);
fprintf(out, "\t\t>%s<\n", nfname);
rfname.Empty();
nfname.Empty();
}
Here's the ourput:
Code:
>NEW_RECORDING_ROOT:[000000]/FCP0002.DIR;1 1/50 11-APR-2005 16:52:14 [SYSTEM] (,RWED,RWED,R)<
>recording:[000000.FCP0002]<
>NEW_RECORDING_ROOT:[000000]/FDAC000.DIR;1 1/50 16-AUG-2005 08:11:00 [SYSTEM] (,RWED,RWED,R)<
>recording:[000000.FDAC000]<
>NEW_RECORDING_ROOT:[000000]/FDAC001.DIR;1
It doesn't print the whole string it stops in the middle of it.
what is missing/