![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| absolute path | Kirichiko | UNIX for Dummies Questions & Answers | 2 | 10-03-2007 03:30 AM |
| $PWD shows absolute path vs path w/symbolic links | kornshellmaven | Shell Programming and Scripting | 3 | 06-13-2007 09:15 AM |
| absolute path | filedeliver | High Level Programming | 4 | 06-05-2007 02:18 PM |
| vi - replacing a relative path with absolute path in a file | Yinzer955i | UNIX for Dummies Questions & Answers | 2 | 09-07-2006 08:47 AM |
| want the current directory without the absolute path | olimiles | Shell Programming and Scripting | 2 | 09-01-2006 04:07 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
HOW to make absolute path???? HELP
In the funtion C function link(char *existing, char *new);
existing has to be an absolute path. But what happens if i want to make a ling to a file in the users home directory (assume file.txt exists) i cant put in a "~/file.txt" or "./file.txt" How can i turn the above into the entire path is there a C call to do it i know the call diname given "~" returns "." which is again what i cant use. I need some help. thanks |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
Please read the rules. There is a link to the rules at the bottom of the page. I deleted the duplicate thread.
link() does not require absolute paths. It will work fine with relative paths. No system call understands the symbol ~ as a directory. That is a shell convention only. You cannot do link("$HOME/filex", "$HOME/bin/filex") either. The symbol ~ is in the boat as $HOME. I assume that you mean dirname() and not diname(). If so you are misunderstanding how it interprets ~. It thinks that ~ is filename. And it returns . as the parent directory of that file. If you want to get the user's home directory, you need either the uid or the name of the user. You can use getpwuid() or getpwname() to get the password file entry. |
||||
| Google The UNIX and Linux Forums |