Skip to content

Instantly share code, notes, and snippets.

@ericwomer
Created October 19, 2014 06:01
Show Gist options
  • Select an option

  • Save ericwomer/0307a66b21e8a4452a21 to your computer and use it in GitHub Desktop.

Select an option

Save ericwomer/0307a66b21e8a4452a21 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <sys/stat.h>
#include <stdbool.h>
#include <wchar.h>
//bool CreateDirectory(const TCHAR* Directory)
//{
// return mkdir(TCHAR_TO_UTF8(*NormalizeFilename(Directory)), 0755) == 0;
//}
typedef wchar_t TCHAR;
bool CreateDirectory(const TCHAR* Directory)
{
return mkdir(*Directory, 0755) == 0;
}
int main(void)
{
const TCHAR TDirectory = "/home/salamanderrake/Documents/WithoutSpace";
const TCHAR TDirectory_With_Space = "/home/salamanderrake/Documents/With Space";
printf("Without spaces in directory path\n");
if(!CreateDirectory(&TDirectory))
{
printf("CreatDirectory without spaces failed \n");
}
printf("With spaces in directory path\n");
if(!CreateDirectory(&TDirectory_With_Space))
{
printf("CreatDirectory with spaces failed \n");
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment