Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Bartc <bc@freeuk.com> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: OT - gcc for Windows not being recognized by Windows 7 |
| Date | 2015-07-05 23:39 +0100 |
| Organization | A noiseless patient Spider |
| Message-ID | <mncblb$coc$1@dont-email.me> (permalink) |
| References | <mmbr1n$m9s$1@dont-email.me> <mnb1hp$ge9$1@dont-email.me> <20150705210821.6bd31567@maxa-pc> <mnc0b8$1o6$1@dont-email.me> <mnc7ie$op$1@news.xmission.com> |
On 05/07/2015 22:28, Kenny McCormack wrote:
> In article <mnc0b8$1o6$1@dont-email.me>, Bartc <bc@freeuk.com> wrote:
> ...
>> But I remember from previous investigations that in Linux, it is
>> apparently impossible to find out where the executable was started from,
>> so there's no way to access any support files that way if they're in the
>> same place, unless the location is hard-coded.
> This is actually pretty funny. It turns out that it is quite
> straightforward in Linux to determine the running program via
> /proc/self/exe.
Thanks, that seems to work!
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
int main(int nparams,char** params) {
char buffer[100];
int n;
printf("Param[0]=%s\n",params[0]);
n = readlink("/proc/self/exe",buffer,100);
printf("n=%d\n",n);
printf("errno=%d\n",errno);
if (n>=0) buffer[n]=0;
puts(buffer);
}
> 2) You don't want to do this. Because the reason you want to do this
> is so that you can find your config files (as Bart does here) and
> that's NOT THE UNIX WAY.
>
> So, I think what has happened is that Bart probably asked the question once
I did ask the question, and those were exactly the answers I got!
--
Bartc
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar
Re: OT - gcc for Windows not being recognized by Windows 7 raltbos@xs4all.nl (Richard Bos) - 2015-07-03 17:36 +0000
Re: OT - gcc for Windows not being recognized by Windows 7 Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-07-03 19:22 +0100
Re: OT - gcc for Windows not being recognized by Windows 7 Bartc <bc@freeuk.com> - 2015-07-03 23:37 +0100
Re: OT - gcc for Windows not being recognized by Windows 7 Bartc <bc@freeuk.com> - 2015-07-05 00:58 +0100
Re: OT - gcc for Windows not being recognized by Windows 7 Ian Collins <ian-news@hotmail.com> - 2015-07-05 14:58 +1200
Re: OT - gcc for Windows not being recognized by Windows 7 Bartc <bc@freeuk.com> - 2015-07-05 11:41 +0100
Re: OT - gcc for Windows not being recognized by Windows 7 Bartc <bc@freeuk.com> - 2015-07-05 11:50 +0100
Re: OT - gcc for Windows not being recognized by Windows 7 gazelle@shell.xmission.com (Kenny McCormack) - 2015-07-05 12:18 +0000
Re: OT - gcc for Windows not being recognized by Windows 7 gazelle@shell.xmission.com (Kenny McCormack) - 2015-07-05 12:20 +0000
Re: OT - gcc for Windows not being recognized by Windows 7 Geoff <geoff@invalid.invalid> - 2015-07-05 11:30 -0700
Re: OT - gcc for Windows not being recognized by Windows 7 Melzzzzz <mel@zzzzz.com> - 2015-07-05 21:08 +0200
Re: OT - gcc for Windows not being recognized by Windows 7 Bartc <bc@freeuk.com> - 2015-07-05 20:26 +0100
Re: OT - gcc for Windows not being recognized by Windows 7 Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2015-07-05 15:45 -0400
Re: OT - gcc for Windows not being recognized by Windows 7 Melzzzzz <mel@zzzzz.com> - 2015-07-05 21:57 +0200
Re: OT - gcc for Windows not being recognized by Windows 7 gazelle@shell.xmission.com (Kenny McCormack) - 2015-07-05 21:28 +0000
Re: OT - gcc for Windows not being recognized by Windows 7 Bartc <bc@freeuk.com> - 2015-07-05 23:39 +0100
Re: OT - gcc for Windows not being recognized by Windows 7 Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2015-07-05 23:39 -0400
Re: OT - gcc for Windows not being recognized by Windows 7 Bartc <bc@freeuk.com> - 2015-07-06 12:56 +0100
Re: OT - gcc for Windows not being recognized by Windows 7 gazelle@shell.xmission.com (Kenny McCormack) - 2015-07-06 12:58 +0000
Re: OT - gcc for Windows not being recognized by Windows 7 Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2015-07-06 09:55 -0400
Re: OT - gcc for Windows not being recognized by Windows 7 Richard Kettlewell <rjk@greenend.org.uk> - 2015-07-06 16:26 +0100
Re: OT - gcc for Windows not being recognized by Windows 7 Phil Carmody <pc+usenet@asdf.org> - 2015-07-08 19:55 +0300
Re: OT - gcc for Windows not being recognized by Windows 7 Ian Collins <ian-news@hotmail.com> - 2015-07-06 10:39 +1200
Re: OT - gcc for Windows not being recognized by Windows 7 luser droog <luser.droog@gmail.com> - 2015-07-05 20:30 -0700
csiph-web