?
Solved

Opening a file  or folder in C++

Posted on 2003-03-01
4
Medium Priority
?
239 Views
Last Modified: 2010-04-02
Hey I have a quick question, how can I open a file and read the contents in c++, but what I really want to do is just ask windows to do it from a c++ program. Like make a call and have a folder open (like if you had just dbl clicked your "My Computer" folder on your desktop), or have your program have windows open up your word doc, in micr$oft word. Any help would be great, thanks-
-=Mack=-
0
Comment
Question by:-Mack-
[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 32

Accepted Solution

by:
jhance earned 200 total points
ID: 8047323
ShellExecute() does this.  It will open files or folders or applications.  Whatever you tell it to do.
0
 

Expert Comment

by:alexanderthegreat
ID: 8047613
Maybe this is what you mean.


#include <stdlib.h>



void main()
{
     system("dir");
}
0
 

Author Comment

by:-Mack-
ID: 8048927
jhance that is what i was looking for thanks, I have another quick question though, when I compile in my command promt in java I can type in                     set path=%path%;c:\j2sdk1.4.0_01\bin   and in so it will know where my compiler is in that way I can use my windows command promt more like a linux machine. When I compile i just type in javac -classpath ... then file.java ,  when trying to do the same with the borland c++ compiler, it has trouble finding my libraries. In the question above forinstance it was unable to find the windows.h   can you help me out? thank,
-Mack-
0
 
LVL 32

Expert Comment

by:jhance
ID: 8051262
I'm not familiar with Borland C++ but I suspect that it uses either an ENV variable or a command line option to locate the INCLUDE file directory.  Check the docs....
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
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.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

800 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