Thread: Drag and Drop files/Read and write files

  1. #1
    Registered User
    Join Date
    Sep 2010
    Location
    Portugal
    Posts
    22

    Wink Drag and Drop files/Read and write files

    Hello everyone,

    How to make a C program that reads a file when it is dragged over it? (.exe).

    I'd also like to know more about writing files with C (links possibly ? ;D).

    Thanks in advance,

    Scout

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    When you drag a file over a program, the pathname to that file is passed to the program as if it were a command-line argument (so you can find it in argv[1]). So you can use that with fopen to open the file.

  3. #3
    Registered User
    Join Date
    Nov 2010
    Location
    Long Beach, CA
    Posts
    5,909
    From the tutorials section on this site: Cprogramming.com - Tutorials - C File I/O.

Popular pages Recent additions subscribe to a feed