• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 245
  • Last Modified:

Opening a file or folder in C++

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
-Mack-
Asked:
-Mack-
  • 2
1 Solution
 
jhanceCommented:
ShellExecute() does this.  It will open files or folders or applications.  Whatever you tell it to do.
0
 
alexanderthegreatCommented:
Maybe this is what you mean.


#include <stdlib.h>



void main()
{
     system("dir");
}
0
 
-Mack-Author Commented:
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
 
jhanceCommented:
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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now