You don't change any of the STARTUPINFO members from the example. You copy the code exactly and only change where the data is being redirected.
Code:
   for (;;) 
   { 
      // Read from standard input. 
      fSuccess = ReadFile(hStdin, chBuf, BUFSIZE, &dwRead, NULL); 
      if (! fSuccess || dwRead == 0) 
         break; 
 
      // Write to standard output. 
      fSuccess = WriteFile(hStdout /*replace with file handle*/, chBuf, dwRead, &dwWritten, NULL); 
      if (! fSuccess) 
         break; 
   }
gg