TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: SADOVNIKOV SERGEY
from: ALEXANDER NAUMOCHKIN
date: 1997-07-07 22:20:00
subject: Re: String manipulation

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)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.