Opening a file with my application...

This is a discussion on Opening a file with my application... within the Windows Programming forums, part of the Platform Specific Boards category; I'm writing a video player. When you open it you can browse for the video file to open via an ...

  1. #1
    Registered User
    Join Date
    Apr 2007
    Posts
    55

    Opening a file with my application...

    I'm writing a video player. When you open it you can browse for the video file to open via an open file dialog. The string I get with that I send it to the function that has the fopen. It works.

    Also, if I comment the open file dialog and get the file path via parameters, it works.

    However, if I use "Open With..." from Windows, and send the path I get from the parameters (I checked, it's the correct path), the fopen fails. Why is that?

  2. #2
    Registered User
    Join Date
    Apr 2007
    Posts
    55
    It's between " "! I'll take them out, manually. Any easy way to do it?

  3. #3
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,556
    Look at the error status of fopen, and let it tell you why.

    fp = fopen( blah, "rb" );
    if ( fp == NULL ) perror( "humbug" );

    Or strerror() if you want a string for a popup.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. To find the memory leaks without using any tools
    By asadullah in forum C Programming
    Replies: 2
    Last Post: 05-12-2008, 07:54 AM
  2. Can we have vector of vector?
    By ketu1 in forum C++ Programming
    Replies: 24
    Last Post: 01-03-2008, 04:02 AM
  3. gcc link external library
    By spank in forum C Programming
    Replies: 6
    Last Post: 08-08-2007, 03:44 PM
  4. Possible circular definition with singleton objects
    By techrolla in forum C++ Programming
    Replies: 3
    Last Post: 12-26-2004, 09:46 AM
  5. System
    By drdroid in forum C++ Programming
    Replies: 3
    Last Post: 06-28-2002, 10:12 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21