tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fw: [Tinycc-devel] windows resources LinkRes2Exe.exe by Mike Henning


From: bertie
Subject: Re: Fw: [Tinycc-devel] windows resources LinkRes2Exe.exe by Mike Henning
Date: Fri, 6 Oct 2006 06:13:42 +0200
User-agent: KMail/1.7.2

Restart itself is not possible: only an extern app could. Like a batch for 
example.

On a side note, storing wave files within the exe for a text-to-speech program 
might show some limits quickly as there are 5000 usual english words.
With such a weight, loading the exe would be slow and overconsume memory.
Store them in a zip file instead just my 2 sense.

On Thursday 05 October 2006 22:10, Rob Landley wrote:
> On Thursday 05 October 2006 3:28 pm, Laurens Simonis wrote:
> >  > and at finally it worked!!! thank you very much!!
> >  > to all, how does one code a c program that knows its executable name
> >  > and can restart itself?
> >
> > The executable name can be found in argv[0] I think. Starting an exe can
> > be done with system();
> >
> > #include <stdio.h>
> >
> > int main(int argc, char **argv)
> > {
> >    printf(argv[0]);
> >    return 0;
> > }
>
> That's a little oversimplified.  The path isn't reliably in there, and the
> executable might not be in $PATH.  On linux, you can exec /proc/self/exe
> and expect it to work.  (I don't do Windows.)
>
> Also, system() washes stuff through "/bin/sh", which spawns an extra
> process and it's a child process rather than a restart.  On Linux you want
> one of the exec() family of calls (man exec).  Possibly execvp();
>
> Rob




reply via email to

[Prev in Thread] Current Thread [Next in Thread]