Thread: Collecting file name

  1. #1
    Registered User
    Join Date
    Nov 2004
    Posts
    4

    Collecting file name

    I am trying to write a program to accosiate with zip files. Basically, I want to double click a zip file, have it load up my program and pass it the name of the zip file and then have my program call a batch file passing this data.

    I think I can do most of it, but I have no idea how to collect the file name when the program is called from an association.

    Anyone have any ideas where to start? Just the name of a function to look at would be great.

    Cheers - LinkJames

  2. #2
    Registered User
    Join Date
    Nov 2004
    Posts
    4
    Never mind, I have found out myself. For those interested, its the same as code for taking command line arguments (Why didn't I think of that to start with)

    For those interested, this code outputs the name of the program then the name of the program that called it:

    Code:
    #include <fstream>
    #include <iostream>
    
    using namespace std;
    
    int main ( int argc, char *argv[] )
    {
      
        cout<<argv[0]<<"\n";
        cout<<argv[1]<<"\n";
                    cin.get();
      
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Encryption program
    By zeiffelz in forum C Programming
    Replies: 1
    Last Post: 06-15-2005, 03:39 AM
  2. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 09:54 AM
  3. archive format
    By Nor in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 08-05-2003, 07:01 PM
  4. Making a LIB file from a DEF file for a DLL
    By JMPACS in forum C++ Programming
    Replies: 0
    Last Post: 08-02-2003, 08:19 PM
  5. Need a suggestion on a school project..
    By Screwz Luse in forum C Programming
    Replies: 5
    Last Post: 11-27-2001, 02:58 AM