• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #include <windows.h>
2 #include <stdio.h>
3 #include <sys/stat.h>
4 
5 void
test(char * path)6 test (char *path)
7 {
8   struct stat buf;
9   if (stat(path, &buf) == 0)
10     printf ("OK [%s]\n", path);
11   else {
12     printf ("ERROR [%s]\n", path);
13     abort();
14   }
15 }
16 
17 void
wtest(wchar_t * path)18 wtest (wchar_t *path)
19 {
20   struct stat buf;
21   if (wstat(path, &buf) == 0)
22     wprintf (L"OK [%s]\n", path);
23   else {
24     wprintf (L"ERROR [%s]\n", path);
25     abort();
26   }
27 }
28 
29 int
main(int argc,char ** argv)30 main (int argc, char **argv)
31 {
32   wchar_t windir_wbuf[MAX_PATH + 1];
33   char windir_abuf[MAX_PATH + 1];
34 
35   if (GetWindowsDirectoryA(&windir_abuf[0], MAX_PATH))
36   {
37     strcat (&windir_abuf[0], "\\");
38     test (&windir_abuf[0]);
39   }
40   test ("c:\\");
41   test ("\\");
42   test ("/");
43 
44   if (GetWindowsDirectoryW(&windir_wbuf[0], MAX_PATH))
45   {
46     wcscat (&windir_wbuf[0], L"\\");
47     wtest (windir_wbuf);
48   }
49   wtest (L"c:\\");
50   wtest (L"\\");
51   wtest (L"/");
52   return 0;
53 }
54