?
Solved

Changing directories

Posted on 2004-05-01
2
Medium Priority
?
357 Views
Last Modified: 2010-04-01

In my code, I have to change directories but chdir does not work.  How do I go about setting the directory?

One more thing too...If you want to start polling in one directory,
Directory 1: /temp/dir1

I am getting a file from that directory and wanting to move it to another directory, /temp/dir2/  
In that directory, I want to run a tool which generates another file but I want to set the directory to dir2 for the duration of the program.  How would I do that?  (Linux platform).
0
Comment
Question by:jewee
2 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 1600 total points
ID: 10969116
What does 'chdir()' return? E.g.

if ( -1 == chdir ( "/temp/dir")) perror ( "invalid path for chdir");
0
 

Author Comment

by:jewee
ID: 10969169
Unbelievable, apparently, when I used chdir, i included another / like this "/temp/dir/"

thanks!
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
Suggested Courses

864 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