comment in msdn:
Note If used in a Windows program, the _popen function returns an invalid file pointer that will cause the program to hang indefinitely. _popen works properly in a Console application. To create a Windows application that redirects input and output, see Creating a Child Process with Redirected Input and Output in the Platform SDK.
to open a file use ShellExecute (http://msdn.microsoft.com/en-us/library/bb762153(VS.85).aspx). You have to include shellapi.h and bind shell32.lib