473,767 Members | 8,004 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Portable way of obtaining current working directory......

Hi,

I'm working on a portable ANSI C++ application designed to compile and
execute under Windows and LINUX/UNIX.

Is there a portable way of obtaining the current working directory? Sorry,
if I'm being stupid...

Thanks,

Shaun
Jul 22 '05 #1
6 5400
Shaun Heveron wrote:
I'm working on a portable ANSI C++ application designed to compile and
execute under Windows and LINUX/UNIX.

Is there a portable way of obtaining the current working directory? Sorry,
if I'm being stupid...


You're not being stupid, you're just being in the wrong newsgroup.
I'd recommend asking in both Windows (comp.os.ms-windows.program mer)
and Linux (comp.os.linux. development.app s) newsgroups. If you care
about UNIX, you'd have to extend your search to the appropriate UNIX
newsgroup too.

The trouble is, C++ doesn't have any way of obtaining "current" or
"working" directory because it doesn't have the concept of 'a directory'.

V

Jul 22 '05 #2
Victor Bazarov wrote:
Shaun Heveron wrote:
I'm working on a portable ANSI C++ application designed to compile and
execute under Windows and LINUX/UNIX.

Is there a portable way of obtaining the current working directory?
Sorry, if I'm being stupid...


You're not being stupid, you're just being in the wrong newsgroup.
I'd recommend asking in both Windows (comp.os.ms-windows.program mer)
and Linux (comp.os.linux. development.app s) newsgroups. If you care
about UNIX, you'd have to extend your search to the appropriate UNIX
newsgroup too.

The trouble is, C++ doesn't have any way of obtaining "current" or
"working" directory because it doesn't have the concept of 'a directory'.

V


Take a look here:

http://tinf2.vub.ac.be/~dvermeir/software/dv/index.html
Jul 22 '05 #3
Lieven wrote:
Victor Bazarov wrote:
Shaun Heveron wrote:
I'm working on a portable ANSI C++ application designed to compile and
execute under Windows and LINUX/UNIX.

Is there a portable way of obtaining the current working directory?
Sorry, if I'm being stupid...


You're not being stupid, you're just being in the wrong newsgroup.
I'd recommend asking in both Windows (comp.os.ms-windows.program mer)
and Linux (comp.os.linux. development.app s) newsgroups. If you care
about UNIX, you'd have to extend your search to the appropriate UNIX
newsgroup too.

The trouble is, C++ doesn't have any way of obtaining "current" or
"working" directory because it doesn't have the concept of 'a directory'.

V


Take a look here:

http://tinf2.vub.ac.be/~dvermeir/software/dv/index.html


And especially this will interest you:

http://tinf2.vub.ac.be/~dvermeir/sof...Directory.html
Jul 22 '05 #4
Lieven wrote:
Lieven wrote:

Victor Bazarov wrote:

Shaun Heveron wrote:
[...]
V


Take a look here:

http://tinf2.vub.ac.be/~dvermeir/software/dv/index.html

And especially this will interest you:

http://tinf2.vub.ac.be/~dvermeir/sof...Directory.html


Next time you might consider replying directly to the original poster.
Jul 22 '05 #5

"Shaun Heveron" <fr**@fred.co m> wrote in message
news:41******** *************** @news.zen.co.uk ...
Hi,

I'm working on a portable ANSI C++ application designed to compile and
execute under Windows and LINUX/UNIX.

Is there a portable way of obtaining the current working directory? Sorry,
if I'm being stupid...


See http://www.boost.org/libs/filesystem/doc/index.htm which supports
windows and POSIX file systems in a semi-portable fashion.

Jeff F
Jul 22 '05 #6
Victor Bazarov wrote:
Lieven wrote:
Lieven wrote:

Victor Bazarov wrote:
Shaun Heveron wrote:
[...]
V

Take a look here:

http://tinf2.vub.ac.be/~dvermeir/software/dv/index.html

And especially this will interest you:

http://tinf2.vub.ac.be/~dvermeir/sof...Directory.html
Next time you might consider replying directly to the original poster.


Sorry for the mistake, pretty new to newsgroups.
Jul 22 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
1777
by: Marek Kotowski | last post by:
The problem: I'd like to build – with PHP – a background-image url on a server (Apache) (url itself or a full directory name). I'd like to use a portable mechanism, I mean a PHP script should work in Windows, Unix and Linux. In Windows I use: ... <style type="text/css">
5
1022
by: Mario Rodriguez | last post by:
Hi people, Does anyone have some idea how to get the password of an active directory user? I tried using the DirectorySearcher object to find the user and the DirectoryEntry.Password property to get the value, but always returns "null" and I'm totally sure that the password is not null thanks
1
7628
by: Tony | last post by:
Guys How do I find the directory that my current application is running in? e.g. if i wanted to find the current working directory of regedit internally (i.e. within the regedit program) it would have C:\Winnt returned. Thanks
0
1337
by: VP | last post by:
Hi there, well i am stuck on a problem with regards to obtaining security permissions on folders. At the moment I have created a simple treeview example which shows all sub-directories in a tree form for a particular directory. Then I wanted to see how the application would handle a sub-directory(test1) if the current user logged on win2k box didnt have the permissions to access test1. The application throws an exception
4
3684
by: Jeff | last post by:
I feel like I should have been able to figure this out but I can't seem to find any references on this topic. It seems like my current working directory is consistently a few directories up from where I am storing the file - not what I would have expected. I would have expected it to be the same directory as the dir with my code - I guess I was wrong because thats not what is happening. On my own computer it wasn't a big problem...
5
1898
by: zion_zii | last post by:
Im working on an embedded project and i have to obtain individual digits from a byte thats the output of a device. Im trying to output this info to an LCD and need to convert it to ASCII first. I have the following which only works for single digits but not double digits. (Data from chip is stored in current array and needs to be converted and stored in array hours). hours = 0x30 | ((current & 0x70) >> 4); //obtain the tens minute digit...
3
3190
by: Chris Mellon | last post by:
This appears to be a change in behavior from Python 2.4 to Python 2.5, which I can't find documented anywhere. It may be windows only, or related to Windows behavior. In 2.4, the current directory (os.curdir) was on sys.path. In 2.5, it appears to be the base directory of the running script. For example, if you execute the file testme.py in your current working directory, '' is on sys.path. If you execute c:\Python25\Scripts\testme.py,...
3
8243
by: duyanning | last post by:
I have written a pyhton script that will process data file in current working directory. My script is in an different directory to data file. When I debug this script using pdb within emacs, emacs will change the current working directory to the directory which include the script, so my script cannot find the data file. I think this is the problem of emacs because when I start pdb from console directly, it will not change current...
2
2626
by: Kakkanattu | last post by:
Hi, In desktop application, we use different ways to get the current execution directory. I. AppDomain.CurrentDomain.BaseDirectory II. Environment.CurrentDirectory III. Directory.GetCurrentDirectory() IV. Assembly.GetExecutingAssembly().Location Can u please help me to know the difference of all these? Also is there any other way to get the current directory other than the above?
0
10170
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10014
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9960
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8840
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7384
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5425
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3931
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3534
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2808
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.