in reply to Re^2: true from (-e "") on Windoze (" is an illegal filename character
in thread true from (-e "") on Windoze
Sorry, but you are wrong. Here is the proof:
#include <stdio.h> #include <sys/types.h> #include <sys/stat.h> int main( int argc, char **argv ) { struct _stat buf1, buf2; char *file = "\"\""; printf( "for %s; stat returned: %d\n", file, _stat( file, &buf1 ) +); printf( "gid: %d\natime:%I64x\nctime:%I64x\ndrive:%d\n" "inode:%d\nmode:%x\nmtime:%I64x\nnlink:%d\nrdev:%d\n" "size:%d\nuid:%d\n", buf1.st_gid, buf1.st_atime, buf1.st_ctime, buf1.st_dev, buf1.st_ino, buf1.st_mode, buf1.st_mtime, buf1.st_nlink, buf1. +st_rdev, buf1.st_size, buf1.st_uid ); printf( "\nFor %s; stat returned: %d\n", argv[1], _stat( argv[1], +&buf2 ) ); printf( "gid: %d\natime:%I64x\nctime:%I64x\ndrive:%d\n" "inode:%d\nmode:%x\nmtime:%I64x\nnlink:%d\nrdev:%d\n" "size:%d\nuid:%d\n", buf2.st_gid, buf2.st_atime, buf2.st_ctime, buf2.st_dev, buf2.st_ino, buf2.st_mode, buf2.st_mtime, buf2.st_nlink, buf2. +st_rdev, buf2.st_size, buf2.st_uid ); return 1; }
That code first stats the filename '""'; then it stats the pathname passed from the command line in argv1.
Run passing the path of the current directory, both sets of stats are identical:
C:\test>stat c:\test for ""; stat returned: 0 gid: 0 atime:4ff203c6 ctime:49bba448 drive:2 inode:0 mode:41ff mtime:4ff203c6 nlink:1 rdev:2 size:0 uid:0 For c:\test; stat returned: 0 gid: 0 atime:4ff203c6 ctime:49bba448 drive:2 inode:0 mode:41ff mtime:4ff203c6 nlink:1 rdev:2 size:0 uid:0
Explain that in any way other than '""' is being taken to mean 'the current directory'?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: true from (-e "") on Windoze (" is an illegal filename character
by afoken (Chancellor) on Jul 03, 2012 at 19:22 UTC | |
by BrowserUk (Patriarch) on Jul 03, 2012 at 19:47 UTC | |
by afoken (Chancellor) on Jul 05, 2012 at 20:13 UTC | |
by BrowserUk (Patriarch) on Jul 05, 2012 at 20:39 UTC | |
by Anonymous Monk on Jul 03, 2012 at 19:44 UTC | |
by afoken (Chancellor) on Jul 05, 2012 at 19:55 UTC | |
by Anonymous Monk on Jul 03, 2012 at 19:48 UTC |