[vorbis-dev] More changes to the win32 build environment
Chris Wolf
cwolf at starclass.com
Mon Oct 22 20:08:08 PDT 2001
I know, I know. I decided to let the fact that the program was exiting take care of that....
On 10/22/2001 at 10:13 PM Matthijs Laan wrote:
>On Mon 22 Oct 2001 15:20:33, "Chris Wolf" <cwolf at starclass.com> wrote:
>
>You forgot to free() :)
>
>Version 1.3:
>
>#include <windows.h>
>#include <winbase.h>
>#include <stdio.h>
>#include <string.h>
>
>int main(int argc, char **argv)
>{
> STARTUPINFO si;
> PROCESS_INFORMATION pi;
>
> char *cmdline;
> int c;
> int i;
>
> if(argc==1)
> {
> (void)fprintf(stderr, "Usage: execwait commands\n");
> exit(1);
> }
>
> for(i=1,c=0;i<argc;i++)
> c+=strlen(argv[i])+1; /* allow one for space */
>
> cmdline = (char *)malloc(c+1); /* allow one for zero terminator */
> *cmdline = '\0';
>
> for(i=1;i<argc;i++)
> {
> (void)strcat(cmdline, argv[i]);
> (void)strcat(cmdline, " ");
> }
>
> memset(&si, 0, sizeof(si));
> si.cb = sizeof(si);
>
> if(!CreateProcess(NULL, cmdline, NULL, NULL, FALSE, 0, NULL, NULL, &si,
>&pi))
> {
> (void)fprintf(stderr, "CreateProcess failed\n");
> free(cmdline);
> return 1;
> }
>
> free(cmdline);
>
> if(WaitForSingleObject(pi.hProcess, INFINITE)==WAIT_FAILED)
> return 1;
> else
> return 0;
>}
>
>Matthijs
>
>--- >8 ----
>List archives: http://www.xiph.org/archives/
>Ogg project homepage: http://www.xiph.org/ogg/
>To unsubscribe from this list, send a message to
>'vorbis-dev-request at xiph.org'
>containing only the word 'unsubscribe' in the body. No subject is needed.
>Unsubscribe messages sent to the list will be ignored/filtered.
--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'vorbis-dev-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the Vorbis-dev
mailing list