Shell command filename variable.

This is a discussion on Shell command filename variable. within the C++ Programming forums, part of the General Programming Boards category; Hello, I have programmed an application to combine tiff image files into 1 tiff file. The program works if I ...

  1. #1
    Registered User
    Join Date
    Mar 2010
    Posts
    2

    Shell command filename variable.

    Hello,

    I have programmed an application to combine tiff image files into 1 tiff file. The program works if I hardcode the filenames into the application.

    I also have created a shell command which allows me to launch the application by right clicking on a tiff file and clicking a customized option in the context menu.

    My question is, how do I pass the file name of the item I right clicked into a variable which can be used in my c++ code? Also, if I select multiple tiff files and then right click, is there a way to pass all 3 into an array?

    Thanks in advance.

  2. #2
    Registered User
    Join Date
    Jul 2008
    Posts
    37
    If you have your entrypoint main function defined as the following:

    Code:
    int main (int argc, char* argv[])
    Then the argv array contains a list of strings which contain your parameters.

    argc is how many parameters were passed to your program, including the executable name i believe.

  3. #3
    Registered User
    Join Date
    Mar 2010
    Posts
    2
    Thank you, that is extremely useful.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Question about printing a variable???
    By Hoser83 in forum C++ Programming
    Replies: 2
    Last Post: 03-31-2006, 12:57 PM
  2. How accurate is the following...
    By emeyer in forum C Programming
    Replies: 22
    Last Post: 12-07-2005, 11:07 AM
  3. Use of variable
    By alice in forum C Programming
    Replies: 8
    Last Post: 06-05-2004, 07:32 AM
  4. Replies: 2
    Last Post: 04-12-2004, 01:37 AM

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