Visit the LQ Articles and Editorials section
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 10-15-2008, 02:14 AM   #1
Amiya Rath
LQ Newbie
Registered: Oct 2008
Posts: 1

Rep: Reputation: 0
how to get absolute path in a C program,

Hi All,

I want to give the relative path name as argument to a c or c++ program and it will return the absolute path. i am using the getcwd function.
Thanks in advance....

Old 10-15-2008, 05:03 PM   #2
Registered: Jan 2005
Distribution: Archlinux, Debian, grml
Posts: 210

Rep: Reputation: 33
Do you have a code example?
Old 10-15-2008, 08:46 PM   #3
Registered: Feb 2008
Posts: 67

Rep: Reputation: 17
You could chdir() to the relative location and then call getcwd(), or some other scheme.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Absolute path qspares Linux - Software 6 10-02-2007 04:11 AM
Image Path reference in Linux (Absolute path) javabuddy Linux - General 7 06-05-2006 08:45 AM
tar saves absolute path warshke Linux - Software 2 03-27-2006 08:43 AM
absolute path results with ls hawkmauk Programming 12 01-16-2006 10:33 PM
relative to absolute path vishalbutte Programming 4 01-14-2006 04:17 PM

All times are GMT -5. The time now is 03:34 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration