• Creating a directory in a Win10 console application.

    From Peter Percival@21:1/5 to All on Sat Jan 27 14:22:13 2018
    Is there a library function that will create a directory in a Win10
    console application? I can call system("mkdir") but am looking for
    something like fopen(dirname, "w").

    f = fopen(".\\dir\\", "w"); /* With .\\dir\\ not existing */
    i = ferror(f);

    crashes because (it seems) ferror doesn't like a NULL argument. (Nor
    does it create .\\dir\\ before crashing!)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Peter Percival@21:1/5 to Peter Percival on Sat Jan 27 18:33:18 2018
    Peter Percival wrote:
    Is there a library function that will create a directory in a Win10
    console application?  I can call system("mkdir") but am looking for
    something like fopen(dirname, "w").

        f = fopen(".\\dir\\", "w");    /* With .\\dir\\ not existing */
        i = ferror(f);

    crashes because (it seems) ferror doesn't like a NULL argument.  (Nor
    does it create .\\dir\\ before crashing!)


    Trying to use creat produces error message "undefined reference to
    creat". Presumably that's the linker.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Luuk@21:1/5 to Peter Percival on Sat Jan 27 19:45:32 2018
    On 27-01-18 19:33, Peter Percival wrote:
    Peter Percival wrote:
    Is there a library function that will create a directory in a Win10
    console application?  I can call system("mkdir") but am looking for
    something like fopen(dirname, "w").

         f = fopen(".\\dir\\", "w");    /* With .\\dir\\ not existing */ >>      i = ferror(f);

    crashes because (it seems) ferror doesn't like a NULL argument.  (Nor
    does it create .\\dir\\ before crashing!)


    Trying to use creat produces error message "undefined reference to
    creat".  Presumably that's the linker.


    https://msdn.microsoft.com/en-us/library/windows/desktop/aa363855(v=vs.85).aspx

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Peter Percival@21:1/5 to Luuk on Sat Jan 27 18:58:15 2018
    Luuk wrote:
    On 27-01-18 19:33, Peter Percival wrote:
    Peter Percival wrote:
    Is there a library function that will create a directory in a Win10
    console application?  I can call system("mkdir") but am looking for
    something like fopen(dirname, "w").

         f = fopen(".\\dir\\", "w");    /* With .\\dir\\ not existing */
         i = ferror(f);

    crashes because (it seems) ferror doesn't like a NULL argument.  (Nor
    does it create .\\dir\\ before crashing!)


    Trying to use creat produces error message "undefined reference to
    creat".  Presumably that's the linker.


    https://msdn.microsoft.com/en-us/library/windows/desktop/aa363855(v=vs.85).aspx

    Is that callable in console applications?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Luuk@21:1/5 to Peter Percival on Sat Jan 27 20:00:45 2018
    On 27-01-18 19:58, Peter Percival wrote:
    Luuk wrote:
    On 27-01-18 19:33, Peter Percival wrote:
    Peter Percival wrote:
    Is there a library function that will create a directory in a Win10
    console application?  I can call system("mkdir") but am looking for
    something like fopen(dirname, "w").

          f = fopen(".\\dir\\", "w");    /* With .\\dir\\ not existing */
          i = ferror(f);

    crashes because (it seems) ferror doesn't like a NULL argument.  (Nor >>>> does it create .\\dir\\ before crashing!)


    Trying to use creat produces error message "undefined reference to
    creat".  Presumably that's the linker.


    https://msdn.microsoft.com/en-us/library/windows/desktop/aa363855(v=vs.85).aspx


    Is that callable in console applications?



    Yes, this code will create a directory named 'mymkdir' (under the
    current directory:

    #include <stdio.h>
    #include <windows.h>

    int main()
    {
    CreateDirectory("mymkdir", NULL);
    return 0;
    }

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Peter Percival@21:1/5 to Luuk on Sat Jan 27 19:20:26 2018
    Luuk wrote:
    On 27-01-18 19:58, Peter Percival wrote:
    Luuk wrote:
    On 27-01-18 19:33, Peter Percival wrote:
    Peter Percival wrote:
    Is there a library function that will create a directory in a Win10
    console application?  I can call system("mkdir") but am looking for >>>>> something like fopen(dirname, "w").

          f = fopen(".\\dir\\", "w");    /* With .\\dir\\ not existing */
          i = ferror(f);

    crashes because (it seems) ferror doesn't like a NULL argument.  (Nor >>>>> does it create .\\dir\\ before crashing!)


    Trying to use creat produces error message "undefined reference to
    creat".  Presumably that's the linker.


    https://msdn.microsoft.com/en-us/library/windows/desktop/aa363855(v=vs.85).aspx


    Is that callable in console applications?



    Yes, this code will create a directory named 'mymkdir' (under the
    current directory:

    #include <stdio.h>
    #include <windows.h>

    int main()
    {
    CreateDirectory("mymkdir", NULL);
    return 0;
    }


    Thank you.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Luuk@21:1/5 to Peter Percival on Sun Jan 28 15:17:11 2018
    On 28-01-18 14:36, Peter Percival wrote:
    Peter Percival wrote:
    Luuk wrote:
    On 27-01-18 19:58, Peter Percival wrote:
    Luuk wrote:
    On 27-01-18 19:33, Peter Percival wrote:
    Peter Percival wrote:
    Is there a library function that will create a directory in a Win10 >>>>>>> console application?  I can call system("mkdir") but am looking for >>>>>>> something like fopen(dirname, "w").

           f = fopen(".\\dir\\", "w");    /* With .\\dir\\ not >>>>>>> existing */
           i = ferror(f);

    crashes because (it seems) ferror doesn't like a NULL argument.  >>>>>>> (Nor
    does it create .\\dir\\ before crashing!)


    Trying to use creat produces error message "undefined reference to >>>>>> creat".  Presumably that's the linker.


    https://msdn.microsoft.com/en-us/library/windows/desktop/aa363855(v=vs.85).aspx



    Is that callable in console applications?



    Yes, this code will create a directory named 'mymkdir' (under the
    current directory:

    #include <stdio.h>
    #include <windows.h>

    int main()
    {
        CreateDirectory("mymkdir", NULL);
        return 0;
    }


    Thank you.

    There is also mkdir in direct.h


    the difference between mkdir and CreateDirectory is explained here: https://stackoverflow.com/questions/24205401/difference-between-mkdir-and-createdirectory

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Peter Percival@21:1/5 to Peter Percival on Sun Jan 28 13:36:01 2018
    Peter Percival wrote:
    Luuk wrote:
    On 27-01-18 19:58, Peter Percival wrote:
    Luuk wrote:
    On 27-01-18 19:33, Peter Percival wrote:
    Peter Percival wrote:
    Is there a library function that will create a directory in a Win10 >>>>>> console application?  I can call system("mkdir") but am looking for >>>>>> something like fopen(dirname, "w").

           f = fopen(".\\dir\\", "w");    /* With .\\dir\\ not >>>>>> existing */
           i = ferror(f);

    crashes because (it seems) ferror doesn't like a NULL argument.  (Nor >>>>>> does it create .\\dir\\ before crashing!)


    Trying to use creat produces error message "undefined reference to
    creat".  Presumably that's the linker.


    https://msdn.microsoft.com/en-us/library/windows/desktop/aa363855(v=vs.85).aspx



    Is that callable in console applications?



    Yes, this code will create a directory named 'mymkdir' (under the
    current directory:

    #include <stdio.h>
    #include <windows.h>

    int main()
    {
        CreateDirectory("mymkdir", NULL);
        return 0;
    }


    Thank you.

    There is also mkdir in direct.h

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Peter Percival@21:1/5 to Luuk on Sun Jan 28 16:07:26 2018
    Luuk wrote:
    On 28-01-18 14:36, Peter Percival wrote:
    Peter Percival wrote:
    Luuk wrote:
    On 27-01-18 19:58, Peter Percival wrote:
    Luuk wrote:
    On 27-01-18 19:33, Peter Percival wrote:
    Peter Percival wrote:
    Is there a library function that will create a directory in a Win10 >>>>>>>> console application?  I can call system("mkdir") but am looking for >>>>>>>> something like fopen(dirname, "w").

           f = fopen(".\\dir\\", "w");    /* With .\\dir\\ not >>>>>>>> existing */
           i = ferror(f);

    crashes because (it seems) ferror doesn't like a NULL argument. >>>>>>>> (Nor
    does it create .\\dir\\ before crashing!)


    Trying to use creat produces error message "undefined reference to >>>>>>> creat".  Presumably that's the linker.


    https://msdn.microsoft.com/en-us/library/windows/desktop/aa363855(v=vs.85).aspx



    Is that callable in console applications?



    Yes, this code will create a directory named 'mymkdir' (under the
    current directory:

    #include <stdio.h>
    #include <windows.h>

    int main()
    {
        CreateDirectory("mymkdir", NULL);
        return 0;
    }


    Thank you.

    There is also mkdir in direct.h


    the difference between mkdir and CreateDirectory is explained here: https://stackoverflow.com/questions/24205401/difference-between-mkdir-and-createdirectory

    Had you not drawn that to my attention it would not have occurred to me
    to wonder about the difference! Thanks.



    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)