public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] [OT] mkdir in a C program?
@ 2008-04-04 14:57 Denis
  2008-04-04 15:06 ` Ale
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Denis @ 2008-04-04 14:57 UTC (permalink / raw
  To: gentoo-user

Does anyone know if a directory can be created from inside a C program
and how that is done?  Suppose I run the code from my own directory
/home/mydir, and I want the code to create a directory
/home/mydir/mydata, where data is to be written, what would the format
for such a command be?  Also, when you write files to
/home/mydir/mydata, do i put in something like "./mydata/filename" as
the filename to open/write?

Many thanks!
Denis
-- 
gentoo-user@lists.gentoo.org mailing list



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [gentoo-user] [OT] mkdir in a C program?
  2008-04-04 14:57 [gentoo-user] [OT] mkdir in a C program? Denis
@ 2008-04-04 15:06 ` Ale
  2008-04-04 15:10 ` Francisco Rivas
  2008-04-04 15:12 ` Markus Schönhaber
  2 siblings, 0 replies; 9+ messages in thread
From: Ale @ 2008-04-04 15:06 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 633 bytes --]

2008/4/4, Denis <denis.che@gmail.com>:
>
> Does anyone know if a directory can be created from inside a C program
> and how that is done?  Suppose I run the code from my own directory
> /home/mydir, and I want the code to create a directory
> /home/mydir/mydata, where data is to be written, what would the format
> for such a command be?  Also, when you write files to
> /home/mydir/mydata, do i put in something like "./mydata/filename" as
> the filename to open/write?
>
> Many thanks!
> Denis


Take a look on system function, for example system("mkdir /home/mydir");

Cheers!

--
> gentoo-user@lists.gentoo.org mailing list
>
>

[-- Attachment #2: Type: text/html, Size: 1160 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [gentoo-user] [OT] mkdir in a C program?
  2008-04-04 14:57 [gentoo-user] [OT] mkdir in a C program? Denis
  2008-04-04 15:06 ` Ale
@ 2008-04-04 15:10 ` Francisco Rivas
  2008-04-04 15:12 ` Markus Schönhaber
  2 siblings, 0 replies; 9+ messages in thread
From: Francisco Rivas @ 2008-04-04 15:10 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 1073 bytes --]

I found this :

#include<sys/stat.h>

int main(int argc,char **argv){
if (argc < 2) exit(1);
mkdir(argv[1],0777);
return 0;
}
http://gd.tuwien.ac.at/languages/c/programming-dmarshall/node20.html

I hope that can help you :D

On Sat, Apr 5, 2008 at 10:27 AM, Denis <denis.che@gmail.com> wrote:

> Does anyone know if a directory can be created from inside a C program
> and how that is done?  Suppose I run the code from my own directory
> /home/mydir, and I want the code to create a directory
> /home/mydir/mydata, where data is to be written, what would the format
> for such a command be?  Also, when you write files to
> /home/mydir/mydata, do i put in something like "./mydata/filename" as
> the filename to open/write?
>
> Many thanks!
> Denis
> --
> gentoo-user@lists.gentoo.org mailing list
>
>


-- 
Francisco Rivas
http://www.vaslibre.org.ve
-
And on the seventh day God said :wq and then make
http://beck3r.wordpress.com/
Linux User (New) : #448324
Linux Machine (New) : 355187
---
4to Congreso Nacional de SL
http://www.cnsl.org.ve/tiki-index.php?page=carabobo

[-- Attachment #2: Type: text/html, Size: 1764 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [gentoo-user] [OT] mkdir in a C program?
  2008-04-04 14:57 [gentoo-user] [OT] mkdir in a C program? Denis
  2008-04-04 15:06 ` Ale
  2008-04-04 15:10 ` Francisco Rivas
@ 2008-04-04 15:12 ` Markus Schönhaber
  2008-04-04 15:20   ` Denis
  2 siblings, 1 reply; 9+ messages in thread
From: Markus Schönhaber @ 2008-04-04 15:12 UTC (permalink / raw
  To: gentoo-user

Denis wrote:

> Does anyone know if a directory can be created from inside a C program
> and how that is done?

man 2 mkdir

Regards
  mks
-- 
gentoo-user@lists.gentoo.org mailing list



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [gentoo-user] [OT] mkdir in a C program?
  2008-04-04 15:12 ` Markus Schönhaber
@ 2008-04-04 15:20   ` Denis
  2008-04-04 15:22     ` Francisco Rivas
  0 siblings, 1 reply; 9+ messages in thread
From: Denis @ 2008-04-04 15:20 UTC (permalink / raw
  To: gentoo-user

Thank you for all the quick replies!  That answers my question :-)
-- 
gentoo-user@lists.gentoo.org mailing list



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [gentoo-user] [OT] mkdir in a C program?
  2008-04-04 15:20   ` Denis
@ 2008-04-04 15:22     ` Francisco Rivas
  2008-04-04 15:31       ` Denis
  0 siblings, 1 reply; 9+ messages in thread
From: Francisco Rivas @ 2008-04-04 15:22 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 491 bytes --]

:D Good. Wich one you used?


On Sat, Apr 5, 2008 at 10:50 AM, Denis <denis.che@gmail.com> wrote:

> Thank you for all the quick replies!  That answers my question :-)
> --
> gentoo-user@lists.gentoo.org mailing list
>
>


-- 
Francisco Rivas
http://www.vaslibre.org.ve
-
And on the seventh day God said :wq and then make
http://beck3r.wordpress.com/
Linux User (New) : #448324
Linux Machine (New) : 355187
---
4to Congreso Nacional de SL
http://www.cnsl.org.ve/tiki-index.php?page=carabobo

[-- Attachment #2: Type: text/html, Size: 1037 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [gentoo-user] [OT] mkdir in a C program?
  2008-04-04 15:22     ` Francisco Rivas
@ 2008-04-04 15:31       ` Denis
  2008-04-04 15:36         ` Francisco Rivas
  0 siblings, 1 reply; 9+ messages in thread
From: Denis @ 2008-04-04 15:31 UTC (permalink / raw
  To: gentoo-user

Here's the simple program that demonstrates usage that's good enough for me:

#include <sys/stat.h>
#include <sys/types.h>

int main ()
{

  mkdir("./mydata", 0777);

  return 0;

}


On Fri, Apr 4, 2008 at 11:22 AM, Francisco Rivas <taken2k4@gmail.com> wrote:
> :D Good. Wich one you used?
>
>
>
> On Sat, Apr 5, 2008 at 10:50 AM, Denis <denis.che@gmail.com> wrote:
> >
> > Thank you for all the quick replies!  That answers my question :-)
> >
> >
> >
> > --
> >
> > gentoo-user@lists.gentoo.org mailing list
> >
> >
>
>
>
>
> --
> Francisco Rivas
> http://www.vaslibre.org.ve
> -
>  And on the seventh day God said :wq and then make
> http://beck3r.wordpress.com/
>  Linux User (New) : #448324
> Linux Machine (New) : 355187
> ---
> 4to Congreso Nacional de SL
> http://www.cnsl.org.ve/tiki-index.php?page=carabobo
-- 
gentoo-user@lists.gentoo.org mailing list



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [gentoo-user] [OT] mkdir in a C program?
  2008-04-04 15:31       ` Denis
@ 2008-04-04 15:36         ` Francisco Rivas
  2008-04-04 15:38           ` Denis
  0 siblings, 1 reply; 9+ messages in thread
From: Francisco Rivas @ 2008-04-04 15:36 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 1423 bytes --]

Good

Actually a think my question must be "Wich one did you use?" correct?, I
wrote wrong, didn't I?

Thanks in advance. :D

On Sat, Apr 5, 2008 at 11:01 AM, Denis <denis.che@gmail.com> wrote:

> Here's the simple program that demonstrates usage that's good enough for
> me:
>
> #include <sys/stat.h>
> #include <sys/types.h>
>
> int main ()
> {
>
>  mkdir("./mydata", 0777);
>
>  return 0;
>
> }
>
>
> On Fri, Apr 4, 2008 at 11:22 AM, Francisco Rivas <taken2k4@gmail.com>
> wrote:
> > :D Good. Wich one you used?
> >
> >
> >
> > On Sat, Apr 5, 2008 at 10:50 AM, Denis <denis.che@gmail.com> wrote:
> > >
> > > Thank you for all the quick replies!  That answers my question :-)
> > >
> > >
> > >
> > > --
> > >
> > > gentoo-user@lists.gentoo.org mailing list
> > >
> > >
> >
> >
> >
> >
> > --
> > Francisco Rivas
> > http://www.vaslibre.org.ve
> > -
> >  And on the seventh day God said :wq and then make
> > http://beck3r.wordpress.com/
> >  Linux User (New) : #448324
> > Linux Machine (New) : 355187
> > ---
> > 4to Congreso Nacional de SL
> > http://www.cnsl.org.ve/tiki-index.php?page=carabobo
> --
> gentoo-user@lists.gentoo.org mailing list
>
>


-- 
Francisco Rivas
http://www.vaslibre.org.ve
-
And on the seventh day God said :wq and then make
http://beck3r.wordpress.com/
Linux User (New) : #448324
Linux Machine (New) : 355187
---
4to Congreso Nacional de SL
http://www.cnsl.org.ve/tiki-index.php?page=carabobo

[-- Attachment #2: Type: text/html, Size: 2646 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [gentoo-user] [OT] mkdir in a C program?
  2008-04-04 15:36         ` Francisco Rivas
@ 2008-04-04 15:38           ` Denis
  0 siblings, 0 replies; 9+ messages in thread
From: Denis @ 2008-04-04 15:38 UTC (permalink / raw
  To: gentoo-user

> Actually a think my question must be "Wich one did you use?" correct?, I
> wrote wrong, didn't I?

Yea, it should be "Which one did you use?" :-)
-- 
gentoo-user@lists.gentoo.org mailing list



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2008-04-04 15:38 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-04 14:57 [gentoo-user] [OT] mkdir in a C program? Denis
2008-04-04 15:06 ` Ale
2008-04-04 15:10 ` Francisco Rivas
2008-04-04 15:12 ` Markus Schönhaber
2008-04-04 15:20   ` Denis
2008-04-04 15:22     ` Francisco Rivas
2008-04-04 15:31       ` Denis
2008-04-04 15:36         ` Francisco Rivas
2008-04-04 15:38           ` Denis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox