Results 1 to 2 of 2

Thread: ANSI C++ app path?

  1. #1

    Thread Starter
    Addicted Member ChuckB's Avatar
    Join Date
    Jul 2002
    Location
    South Carolina, USA
    Posts
    157

    ANSI C++ app path?

    Hi,
    I know the MFC answer to determining application path and also that argv[0] should return the path.

    However, with my GLUT/OpenGL, this doesn't seem to work. Is there a ANSI C++ function call to read path and file information for an application that doesn't use the above methods?

    Regards,
    ChuckB

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    There is a WinAPI function:
    The GetModuleFileName function retrieves the fully qualified path for the specified module.

    To specify the process that contains the module, use the GetModuleFileNameEx function.


    DWORD GetModuleFileName(
    HMODULE hModule,
    LPTSTR lpFilename,
    DWORD nSize
    );

    Parameters
    hModule
    [in] Handle to the module whose path is being requested. If this parameter is NULL, GetModuleFileName retrieves the path for the current module.
    lpFilename
    [out] Pointer to a buffer that receives a null-terminated string that specifies the fully-qualified path of the module. If the length of the path exceeds the size specified by the nSize parameter, the function succeeds, but the string is truncated to nSize and may not include a null-terminating character.
    Windows NT/2000/XP: The path can have the prefix "\\?\", depending on how the module was loaded. For more information, see Naming a File.

    nSize
    [in] Size of the lpFilename buffer, in TCHARs.
    Why can't you access the command line arguments?
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width