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!)
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.
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
Luuk wrote:
On 27-01-18 19:33, Peter Percival wrote:Is that callable in console applications?
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
On 27-01-18 19:58, Peter Percival wrote:
Luuk wrote:
On 27-01-18 19:33, Peter Percival wrote:Is that callable in console applications?
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
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;
}
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:Is that callable in console applications?
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
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
Luuk wrote:
On 27-01-18 19:58, Peter Percival wrote:
Luuk wrote:
On 27-01-18 19:33, Peter Percival wrote:Is that callable in console applications?
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
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.
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:Is that callable in console applications?
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
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
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 296 |
Nodes: | 16 (3 / 13) |
Uptime: | 70:02:37 |
Calls: | 6,656 |
Calls today: | 2 |
Files: | 12,200 |
Messages: | 5,332,146 |
Posted today: | 1 |