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: | 715 |
| Nodes: | 16 (2 / 14) |
| Uptime: | 145:37:43 |
| Calls: | 12,089 |
| Calls today: | 2 |
| Files: | 15,000 |
| Messages: | 6,517,497 |