streams

Started by
3 comments, last by SiCrane 14 years ago
Hi can anyone tell me how I would physically open a text file using istream/ostream etc... I don't me open it to read but open the text file as if i had double clicked on the file icon?
Advertisement
Depends on which OS you're using. To get the behavior of double-clicking on a file is OS specific and nothing in the C++ (I'm assuming you're talking C++ here since you mentioned istream/ostream) standard library is going to do that for you. Look into the Win32 APIs (assuming you're on Windows) for what you want.
Quote:physically open a text file

I do not recommend this. Last time I've tried to do that my hard disk was screwed.


Seriously: clicky. First result.
From your last sentence, it sounds to me like you're actually wanting to open the text file in the default program assigned to the file (e.g. Notepad). Is that the case? If so, it has nothing to do with istream/ostream.
Using Visual C++ 7.0
For Windows, it sounds like you want the ShellExecute() function.

This topic is closed to new replies.

Advertisement