Is there such a thing as a hard link with windows?
If so how can one be made?
Is there such a thing as a hard link with windows?
If so how can one be made?
"Assumptions are the mother of all **** ups!"
umm... ever heard of a shortcut? You can make a link to almost any file/directory you want (where most Linux distros will not allow you to use the ln command to make a hard link to a directory).
To make a shortcut to any file/folder, right-click and drag a file/folder in any direction. Three options should pop-up and one is to make a shortcut to the item you just dragged. Click and wa-la!
Yes, there are hard links in Windows (only on NTFS). They are not equivalent to shortcuts.
They work like Unix hard links and was implemented in NTFS to make it POSIX-compatible
Even though no Windows GUI uses hard links, you can create them with the function
the security attributes must be NULL, and the other two parameters should be very easy to understand.Code:BOOL CreateHardLink( LPCTSTR lpFileName, LPCTSTR lpExistingFileName, LPSECURITY_ATTRIBUTES lpSecurityAttributes );
I used this a long time ago to fake-share in some file sharing program. They are impossible (unlike linux hardlinks) to distinguish from 'normal' files.
Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling
excellent! Thankyou sang drax that is exactly what I was after.
Yes, i have heard of shortcuts, but if that was what I was asking I would have said symlinks in windows. I would like a program to exist in multiple places with different names, but I was hoping to be more efficient than copying it all over the place. Program has to get its name from argv[0] so shortcuts are out. But thankyou anyway ober.
"Assumptions are the mother of all **** ups!"
??? You can still send command line arguments to a program with a shortcut!! Don't make something harder than it has to be.
really? I didnt know that, I hadn't even considered it but I will now. It would certainly add the advantage of portablility to fat.
Will argv[0] show up the name of the program or the name of the shortcut?
"Assumptions are the mother of all **** ups!"
argv[0] will hold the name of the program even if invoked with the shortcut....
>>Will argv[0] show up the name of the program or the name of the shortcut?
Just try it and see! You shouldn't really rely on argv[0] for the process name, try something like GetModuleFileName (if available!)
So, to clarify your question, if you have a program and a link, like so:
c:\dirA\prog1.exe
c:\dirB\prog1.exe.lnk
... do you want argv[0] to display the same for both, or to be different?
When all else fails, read the instructions.
If you're posting code, use code tags: [code] /* insert code here */ [/code]