Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!samsung!uunet!mcsun!hp4nl!charon!marck From: marck@cwi.nl (Marc H. Kool) Newsgroups: comp.unix.wizards Subject: Question about stat( "", &s ) Keywords: stat(2), directory Message-ID: <8788@boring.cwi.nl> Date: 9 Feb 90 14:30:26 GMT Sender: news@cwi.nl (The Daily Dross) Reply-To: marck@cwi.nl (Marc H. Kool) Organization: CWI, Amsterdam Lines: 51 Is the empty file name an alias for "." ? I have the following program: #include #include #include main() { FILE * fp; struct stat s; fp = fopen( "", "r" ); if (fp == NULL) printf( "can't read \"\"\n" ); else fclose( fp ); fp = fopen( "", "w" ); if (fp == NULL) printf( "can't write \"\"\n" ); else fclose( fp ); if (stat( "", &s ) < 0) perror( "stat" ); else { printf( "mode %07o\n", s.st_mode ); printf( "uid %d gid %d size %d ino %d\n", s.st_uid, s.st_gid, s.st_size, s.st_ino ); } } and the output is: can't read "" can't write "" mode 0040700 uid 406 gid 136 size 512 ino 47440 If I type 'ls -lid .' it occurs that the above is the same as "." Is this OK ? Why does fopen( "", "r" ) fails and fopen( ".", "r" ) not ? -Marc -- ------------ Marc H. Kool, marck@cwi.nl