Solved

write  to a process

Posted on 2004-04-08
9
162 Views
Last Modified: 2010-04-22
sir ,

mkdir rath
 will create a directory  .
with out using system() ,i hve to  
make a directory called xxx

 ie
     int  main(int argc ,char *argv[])
     {
     }
i  hve to pass directory name as an argument.
0
Comment
Question by:karana
9 Comments
 
LVL 12

Expert Comment

by:stefan73
ID: 10783345
Hi karana,
Like this:

int main(int argc,char** argv){
    if(argc!=2){
        [error... not exactly one argument]
    }

    mkdir(argv[0]);
}

Cheers,
Stefan
0
 
LVL 12

Accepted Solution

by:
stefan73 earned 50 total points
ID: 10783350
> mkdir(argv[0]);
...should read
mkdir(argv[1]);

argv[0] is the program name itself, not the first argument.

Stefan
0
 

Author Comment

by:karana
ID: 10791529
sir ,

 i  hve to use popen()
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 

Expert Comment

by:ray_pro2
ID: 10794355
If you intension is just creation of the directory 'xxx', add this line to the body of your main( ):

mkdir(argv[1]);

--supply the directory name as the first argument in the command line following the program name, while running the program.
0
 
LVL 12

Expert Comment

by:stefan73
ID: 10822623
karana,
> popen()
popen is very similar to system, it also has a full shell:

FILE* f=popen("mkdir your_dir","r");
/* Now you can parse mkdir's stdout via freads from f. But as mkdir is mute, not much use here */
pclose(f);

You could parse mkdirs stderr by redirecting it:
FILE* f=popen("mkdir your_dir 2>&1","r");

Then you can catch errors.

Stefan
0
 
LVL 12

Expert Comment

by:stefan73
ID: 10822633
karana,
You have tons of open old questions - please close them.

Stefan
0
 
LVL 1

Expert Comment

by:fyf7262284
ID: 10934795
ok!the function of "mkdir" is right to you!
"man 2 mkdir"
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
tallylog file 2 2,591
Chinese translation in RedHat 10 41
automating commands in linux on start up 2 44
Linux: disable vim auto-comment 7 63
Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now