Solved

Changing directories

Posted on 2004-05-01
2
340 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
[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
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

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
maze travler 6 72
Least Squares Curve Fitting 4 133
Error C2678: binary '!=': no operator found... 4 72
VS2015 Redefinition errors 4 101
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
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 learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

739 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