DOS program path

Using argv[0] on a console program gives you the full pathname. This is good, but I need it in shortened DOS-style so I can use it in system(). You know, the little '~' and no spaces. Is there a way to do this, or do I need to make my own translator (agh!!)?

Re: DOS program path

Originally posted by CodeMonkey Using argv[0] on a console program gives you the full pathname. This is good, but I need it in shortened DOS-style so I can use it in system(). You know, the little '~' and no spaces. Is there a way to do this, or do I need to make my own translator (agh!!)?

well first of all what argv[0] gives you is implementation-specific. second of all taking "longfoobar.foobar" and shortening it to "longfo~1.foo" does absolutely nothing for you; there is no guaranteed correspondance of any sort between the long file names and their shortened versions. also, what compiler is this? i'm curious because djgpp accepts lfns in system() calls, and obviously any windoze compiler will.

>>i'm curious because djgpp accepts lfns in system() calls, and obviously any windoze compiler will.
Hmm... I had a go at this one, and found that long filenames with spaces in them didn't work. I even tried to surround the name with quotes and got no joy. Maybe I'm doing it wrong..... it's too late for me now

Originally posted by Hammer >>i'm curious because djgpp accepts lfns in system() calls, and obviously any windoze compiler will.
Hmm... I had a go at this one, and found that long filenames with spaces in them didn't work. I even tried to surround the name with quotes and got no joy. Maybe I'm doing it wrong..... it's too late for me now

hmmmm....... i know that djgpp's system() works with long file names, but i had never considered spaces in them.... ugg.