Sunday June 29 1997 01:20, Sadovnikov Sergey wrote to Bob Stout:
BS>> Try it with a path name like
BS>> \root.dir\foo\bar\foo.bar\wumpus.txt and you'll see some of the
BS>> problems that the SNIPPETS code knows how to avoid. ;-)
SS> So, let's search dot from the end of string:
SS> char * SearchDot(char * Name) // Return a dot pos in a file name or
SS> NULL // if file name does not have extention
SS> {
SS> int Len = strlen(Name);
SS> for(int n = Len - 1;n >= 0;n ++)
SS> {
SS> if(Name[n] == '.')
SS> return Name + n;
SS> if(Name[n] == '\\') // If file name does not have
SS> extention
SS> return NULL;
SS> }
SS> return NULL;
SS> }
He-he! There are two files named
/~ash/qioc/requeue.in\
and
/~ash/qioc/requeue.out\
NOTE: back-slash character '\' is a part of file-extension. So, what about
your code behaviour? ;-))
Alexander
PS: Stop msdos-style thinking! :)
--- xMail/beta
---------------
* Origin: ASH Project, Moscow (fidonet 2:5020/59)
|