Thread: How can I open up a .pdf or other file (like .txt, .doc or .docx) in a C program?

  1. #1
    Registered User
    Join Date
    Jun 2011
    Posts
    11

    How can I open up a .pdf or other file (like .txt, .doc or .docx) in a C program?

    I am writing a C program for a voice recognition development board. Once the program recognizes me as saying something I want a specific file to be opened. Is there a way that I can have a file opened up in C code? Obviously it will be opened up in its respective program. Once it reaches a specific "if" and evaluates it as true, I want this file opened up. Examples include: .txt, .doc or .docx I have a 64-bit Dell running Windows 7 OS.

  2. #2
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    The easiest way is to capitalize on window's existing file associations using the WinAPI ShellExecute() function. That would let you simply send the filename to the function and it would open in it's pre-associated program.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Download uploaded .doc and .docx file in Asp .net 3.5
    By ravimaurya13 in forum C# Programming
    Replies: 1
    Last Post: 04-24-2011, 08:19 PM
  2. How to open file from program's dir
    By Abda92 in forum C Programming
    Replies: 6
    Last Post: 07-29-2007, 10:23 PM
  3. Open file with program by default..
    By willc0de4food in forum Windows Programming
    Replies: 8
    Last Post: 09-18-2005, 03:50 PM
  4. change this program to open a file
    By A F Army in forum C Programming
    Replies: 3
    Last Post: 04-05-2003, 05:25 PM
  5. get program to open a html file
    By task in forum C Programming
    Replies: 14
    Last Post: 11-09-2001, 12:20 PM

Tags for this Thread