| |
| |
| |
|
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
<ghled> uh oh <ghled> why not? <Alipha> you could look at argv[0] and see if it has the absolute path, relative path, or just the program name on your platform <skie> if you're executing it via the shell, the cwd is probably going to be the same as the directory you were in when you executed the program <sculptor> ghled - can't you use relative address? <skie> I'm 90% sure that cwd is one of the things thats copied with fork <ghled> sculptor, I don't think that would work <sculptor> ghled - don't have a clue <ghled> ok then <Alipha> ghled: do: std::cout << argv[0] << std::endl; and see what's displayed. run the program from a different directory than where the program is <ghled> right, but what if the directory is in the path? <ghled> it would just give the program name <ghled> getcwd doesn't do it <Alipha> well, if you're lucky, argv[0] would be the absolute path. <ghled> I'm not lucky <pepp^> is there a reason why gmail and live.com won't open on ie and opera when they would open in firefox? <Alipha> hold on a sec <ghled> this really shouldn't be so complicated <skie> heh. ironically, this is one of the few things I know how to do on windows but not unix. <ghled> doesn't basically every application need to do this? like for log files <_nx> ghled, yeah, let me think... <ghled> ok <skie> most things you can get away with relative paths for, first of all <ghled> I really don't know any other way around this <ghled> I can't since the directory could be in the user's path <ghled> I guess I can always put it in /tmp or something like that <ghled> but I'd rather not <ghled> there must be some way to get the directory of the executable! <_nx> GetModuleFileName <ghled> this isn't Windows! <ghled> Unix <_nx> heh, sorry <ghled> :( <skie> _nx: as I said above :P <ghled> ok, so what would you do if you had to do something like this? <_nx> what's a unix? <ghled> something terrible <ghled> that gives me nightmares <upb> getwd() or something <ghled> getcwd gives the directory that the user is in <skie> upb: cd /my/path/here; /path/to/exec <upb> hrm <skie> upb: getcwd would return /my/path/here <sculptor> unix is something powerful <upb> use procfs and read the link to exe :P <skie> ghled: http://www.midnightbeach.com/jon/pubs/2002/BorCon.London/Appendix.2.html <ghled> thanks <ghled> waiit <ghled> so this says I'm basically out of luck? <skie> ghled: yeah. <ghled> I just need some local file that my program can write to <skie> ghled: basically, the idea of having hard links ****s everything up <ghled> like a log file <skie> ghled: why not get the system's /var/log directory? <ghled> it's not a log file <ghled> I guess I'll just write to /tmp, dammit! <skie> then /var/* <ghled> it's for cl*** anyway <skie> ah. <skie> why not use .? <ghled> where? <Alipha> cwd <skie> you really should be able to just about everything with relative paths.. <ghled> right, but like I said, what if the user has the application directory in their path? <ghled> then I would just have the program name <ghled> without any path at all <skie> erm <skie> ~/appdir/myapp would still have a directory <skie> and you can always make a subdirectory <lordpil> 'File links are a Unix feature that has no Windows counterpart. When you create a link to a file, you're basically just adding another name for an existing inode.' <lordpil> NT has hard links <skie> lordpil: with much trickery <skie> and restrictions, iirc <skie> and that should be ntfs, not nt, strictly speaking <skie> I've decided COM/process security is the most godawful piece of windows ever invented. <skie> COM itself is alright. ATL makes COM somewhat pretty. security descriptors just blow chunks though. <skie> actually, it may be tied with the registry & having UUIDs for every little goddamned thing. <syle> anyone exp with strsep? <ghled> skie, if I add the directory to my path, argv[0] just gives the program name <lordpil> not really <X-Istence> In other news today, Windows' design still ****s, Sony bundles a rootkit with their DRM CD's and the world still has not imploded! <lordpil> it's an undocumented api <skie> X-Istence: windows has some damn nice parts. <X-Istence> skie: agreed. But as a programmer I have found that the not nice parts take up 90% of the time spent to fix errors. <skie> definitely true. <X-Istence> Whereas on other systems they are more logically done, and thus work far better <X-Istence> and with less hackery <skie> here's the ironic part. <skie> read Inside Windows 2000 sometime <skie> the actual OS is amazingly nice. its just the APIs that **** <X-Istence> What's so ironic about that? <X-Istence> And yes I have wanted to pick up a copy, just not had the time/money. <skie> bug your public library to get it <X-Istence> yaeah <X-Istence> time for bed <X-Istence> see ya <pepp-> www.live.com is a joke. <skie> heh. in theory windows would be a great OS. <pepp-> why is microsoft doing windows live? <skie> in practice, its aggrivating. <pepp-> the search on msft's site, on msdn, on msn and in their windows OS are all different algos <r0bby_> :p <therealna> does anyone know of a guide for MS VIsual C++ <ghled> msdn must have something <therealna> im not a subscriber <ghled> too bad <ghled> you shouldn't need to be <ghled> look at their website for some tutorial <Quant> http://www.vmware.com/support/reference/common/virtual_disks.html <Quant> oops <Pegazus> hi, how are you? wich are the best sorting algorithms? QuickSort in average, HeapSort and MergeSort in worst case... Radix Sort if you have higher bound... wich more? <ghled> are you taking your midterm now? <boxxers> hi <boxxers> im bored. <ghled> how can I create a file on the command line in Unix in one line <ghled> something like cat > file without having to end the input <lenix^> echo "abc" > file <ghled> anyone? <ghled> ohhh <ghled> that's it <ghled> I knew that <ghled> thanks <lenix^> no you didn't <lenix^> hah! <ghled> I did! <lenix^> LOOTER! <boxxers> lol <boxxers> what does the %d, print ? <boxxers> decimal? <NoGods> If only you had documentation for printf. <boxxers> hehe <boxxers> i farted. <boxxers> anyone listen to ampedout? <MachinShi> blah. i'm bored.. <Jey> write some lisp <MachinShi> i'd rather kill myself <boxxers> fuu <boxxers> im just going to write some lisp .... <MachinShi> i'm not in a coding mood.. work drains me.. and i've not been coding enuf at work either :( <Jasonmay> Usually I get nothing done either. But today I had two Bawls for lunch at school and I got so much done today.. <MachinShi> lol <Jasonmay> I still can't settle down. <ghled> what's the best way to tell if an owner has write permission to a file? <ghled> in Unix <Jey> open it for writing? :) <ghled> hmmm <MachinShi> thee's gotta be a function that gets you the permissions on a file <Jey> sure, stat or lstat <ghled> is opening it the easiest way, though?
Return to c++ or Go to some related
logs:
TEACH4America sql conver varchar number only shakced news
|
|