Solved

Open a text file

Posted on 1999-01-27
4
183 Views
Last Modified: 2010-04-02
How can I open a text file or *.doc file by any default viewer or editor of the computer my program would possibly run ! sorry I only have 13 points left
0
Comment
Question by:ahTri
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 22

Accepted Solution

by:
nietod earned 10 total points
ID: 1185285
I assume this is for windows?  Look at ShellExecute().
0
 

Expert Comment

by:mbequette
ID: 1185286
I need a little further explanation.  If you want, for instance notepad to open a text file and your program is to control all of this, you can make a win32 CreateProcess call and pass the file name(parameters) and the executable(notepad) is to use.  This will work for other editors as well.  However, I am not sure by your question what you want.  If this is I can give you further explanation with specific code examples.
hope this helps,
mb
0
 
LVL 22

Expert Comment

by:nietod
ID: 1185287
ShellExecute() works because you don't have to specify the application.  You just specify the file to be opened and windows finds the application to open it--if possible.
0
 

Author Comment

by:ahTri
ID: 1185288
thanks Nietod

for mbequette : what I want is to open a file by what ever a default viewer or editor of the host machine, not a specific one to be defined by CreateProcess ! For example a PC that doesnt have Words it would open a .doc file by WordPad or a wordviewer plugin ... thanks though
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
PDF library for Delphi 2 135
Compile GLUT with Visual Studio 2015 1 206
best sources to up-to-date in C++? 8 102
How to convert Structure to vector of byte and vice versa 5 31
Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question