[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: can swarm create a subdirectory
From: |
Matt Aylward |
Subject: |
Re: can swarm create a subdirectory |
Date: |
Fri, 13 Aug 1999 10:33:37 +0800 |
Marcus and Paul,
Thanks for the thread, I was trying to do this some time ago but the 4-digit
directory permission codes confused me (i.e., the sticky bit).
Paul, using this within the code block I gave you for writing rasters to ascii
would be a significant improvement. As it stands, if the direcrories don't
exist it all falls down.
I have another query in this area, but I will send it with a new thread. --
keep an eye out.
Cheers and Grays,
Matt
Marcus G. Daniels wrote:
> >>>>> "PJ" == Paul Johnson <address@hidden> writes:
>
> PJ> Try telling me how to issue stat and mkdir in the middle of a
> PJ> swarm prgram.
>
> #import <misc.h> // fopen, stat, mkdir, S_IFDIR
>
> #define DIRNAME "somedir"
> #define FILENAME "somefile"
>
> int
> main (int argc, const char **argv)
> {
> struct stat buf;
> FILE *fp;
>
> if (stat (DIRNAME, &buf) == -1)
> {
> if (mkdir (DIRNAME, 0700) == -1)
> abort ();
> }
> else if (!(buf.st_mode & S_IFDIR))
> abort ();
>
> if ((fp = fopen (DIRNAME "/" FILENAME, "w")) == NULL)
> abort ();
>
> fputs ("Hello World\n", fp);
> }
>
> /*
> Local Variables:
> compile-command: "/opt/gnu/bin/gcc -o ensuredir -g -Wno-import
> -L/opt/SUNWtcl/8.0/sun4/lib -R/opt/SUNWtcl/8.0/sun4/lib
> -L/opt/SDGblt/2.4g/lib -R/opt/SDGblt/2.4g/lib -L/opt/SDGlibffi/1.20/lib
> -R/opt/SDGlibffi/1.20/lib -L/opt/SDGswarm/1.4.1/lib -L/opt/SDGzlib/1.1.3/lib
> -L/usr/local/X11/lib -R/usr/local/X11/lib -L/usr/openwin/lib
> -R/usr/openwin/lib -L/opt/SDGhdf5/1.0.1/lib -I/opt/SDGswarm/1.4.1/include
> ensuredir.m -lanalysis -lsimtools -lsimtoolsgui -lactivity -ltkobjc -lrandom
> -lobjectbase -ldefobj -lcollections -lmisc -ltclobjc -ltk8.0 -ltcl8.0 -lBLT
> -lsocket -ldl -lnsl -L/usr/openwin/lib -lhdf5 -lpng -lz -lXpm -lX11 -lffi -lm
> -lobjc -lpthread -lposix4"
> End:
> */
>
> ==================================
> Swarm-Support is for discussion of the technical details of the day
> to day usage of Swarm. For list administration needs (esp.
> [un]subscribing), please send a message to <address@hidden>
> with "help" in the body of the message.
==================================
Swarm-Support is for discussion of the technical details of the day
to day usage of Swarm. For list administration needs (esp.
[un]subscribing), please send a message to <address@hidden>
with "help" in the body of the message.