This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: system mkdir
- From: Peter Brown <pnbrown at llnl dot gov>
- To: cygwin at cygwin dot com
- Date: Thu, 1 Dec 2011 23:32:01 +0000 (UTC)
- Subject: Re: system mkdir
- References: <CAKfLWNo3MTYWNZj0G-giFSe8PkBsP+0P1J+C9u-nrvo0JfrZnw@mail.gmail.com> <CAKfLWNqbU2SAYByjgaXLvLxZFQnNvHfWG+7ww_ORWpdBWpKy4Q@mail.gmail.com> <20111128203357.GB8758@ednor.casa.cgf.cx> <4ED3F409.5020309@redhat.com>
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