delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2011/12/01/18:32:38

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS
X-Spam-Check-By: sourceware.org
To: cygwin AT cygwin DOT com
From: Peter Brown <pnbrown AT llnl DOT gov>
Subject: Re: system mkdir
Date: Thu, 1 Dec 2011 23:32:01 +0000 (UTC)
Lines: 28
Message-ID: <loom.20111202T003035-848@post.gmane.org>
References: <CAKfLWNo3MTYWNZj0G-giFSe8PkBsP+0P1J+C9u-nrvo0JfrZnw AT mail DOT gmail DOT com> <CAKfLWNqbU2SAYByjgaXLvLxZFQnNvHfWG+7ww_ORWpdBWpKy4Q AT mail DOT gmail DOT com> <20111128203357 DOT GB8758 AT ednor DOT casa DOT cgf DOT cx> <4ED3F409 DOT 5020309 AT redhat DOT com>
Mime-Version: 1.0
User-Agent: Loom/3.14 (http://gmane.org/)
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT 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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019