title: Opening generic files with system() in DJGPP C
body: <p>I'm missing something obvious here. I am using the DJGPP C compiler. I can successfully open executables, but not files in their default programs.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int main(void) {
      char sys_cmd[100] = "C:\\WINDOWS\\system32\\Calc.exe";
      system(sys_cmd);
  
      system("\"C:\\TextFile.txt\"");
  
      system("\"www.bbc.co.uk\"");
      getch();
  
      return 0;
  }
  </code></pre>
  
  <p>Running this code causes the calculator to start up. Upon closing the calculator it reports:</p>
  
  <pre><code>Bad command of file name   
  Bad command of file name    
  </code></pre>
  
  <p>So there is an issue with the other two system calls. I have tried adding "START " to the system call but that doesn't fix it. Having just searched my Windows 7 Pro system it doesn't have a START.EXE. Adding "cmd.exe " just starts cmd, so it's as if no arguments are sent.</p>
  
  <p>I can type "C:\TextFile.txt" into cmd normally and it will open notepad.exe with TextFile.txt openned inside.</p>
  
  <p>Ideally I'd use something safer than system() to do this anyway, but I haven't seen any examples of ShellExecute in DJGPP.</p>