This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: system mkdir


Eric Blake <eblake <at> redhat.com> writes:

> 
> On 11/28/2011 01:33 PM, Christopher Faylor wrote:
> >> ?But can't find anything that will programatically create a directory
> >> under Cygwin.
> >>
> >> ?Does anyone know how to do this?
> > 
> > Yes.  Use the mkdir() function.  That is, in fact, very similar to how it
> > should be done in Visual Studio too.
> 
> For a temporary directory, mkdtemp() might be better than mkdir(); but
> either way, you still have to use rmdir() to clean up after you are done.
> 

This seems to work for me.

int MySystem(char *s)
{
  int answer;
  char syscmd[2048];
  sprintf(syscmd,"cmd /c bash -c 'umask 0077;%s'",s);
  answer = system( syscmd );
  return answer;
}




--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]