Solved

Changing directories

Posted on 2004-05-01
2
324 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 400 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

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
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…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

770 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