?
Solved

write  to a process

Posted on 2004-04-08
9
Medium Priority
?
168 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 200 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
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…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

777 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