anyone knows how to use the ShellExecute command?

I’m on Win XP, with cygwin installed.

From the Windows command line, I can run the command c:\cygwin\bin\ls -l > filename

This puts the output of the directory listing of the current directory into the file “filename”

Now, I would like to execute this command inside a C program. Does anyone know how to do this? (what would the exact syntax look like in C ?)

Also, I tried putting this at the header files in my C program using Visual Studio, but it errors out as I attempt to compile the code:

#include “shellapi.h”

I read up further on this, and it looks like I need to use CreateProcess.

Anyone knows how I can solve the above problem using CreateProcess () ?