[vorbis-dev] More changes to the win32 build environment
Matthijs Laan
matthijsln at xs4all.nl
Mon Oct 22 13:13:23 PDT 2001
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.
More information about the Vorbis-dev
mailing list