Hi following is the path of a file (which is stored as a string).
C:/db/OOSA/LIBRARIES/OOSA00/MS/filename.jpg
now I want only the file name from that for eg: "filename", rest should be filtered or removed. How to do that in C? I want to apply that file name to some other stuffs but i want to avoid .jpg extension and the path " C:/db/OOSA/LIBRARIES/OOSA00/MS/" Below is the code:
static mgbool gbeadNApply (mgrec* db, mgrec* parent, mgrec* rec, void* gBead)
{
toolrec* toolRec = (toolrec*)gBead;
if (mgGetCode(rec) == fltXref);
{
char *xName;
parent = mgGetParent(rec);
mgGetAttList(rec,fltXrefFilename,&xName,MG_NULL);
mgSetName(parent,xName);
}
return MG_TRUE;
}
Here xName first collects the filename including path. and in mgSetName also you can see xName ( here xName assigns the collected file name along with path some thing like C:/db/OOSA/LIBRARIES/OOSA00/MS/filename.jpg. Now the thing is I want only the filename part of it to be written to mgSetName. so i want to filter xName for it.