Is it possible? If so someone please tell me how to open a file... eg. i want to the user to view a shockwave movie or i want to open word thru c++(console) ...
Plz someonle help me out...
Im a newbie..
Pritin
Is it possible? If so someone please tell me how to open a file... eg. i want to the user to view a shockwave movie or i want to open word thru c++(console) ...
Plz someonle help me out...
Im a newbie..
Pritin
Do you mean executing an executable file (.exe) or you mean how to open and read file with ASCII content (.txt for example) ?
[C++]
IDE: DevC++ 4.9.9.2 (GCC 3.4.2)
2nd compiler: g++ (GCC 3.4.3/4.0.0)
3rd compiler: Borland 5.5
[C#]
IDE: Microsoft Visual C# Express 2005
2nd IDE: SharpDevelop
2nd compiler: csc in Command Prompt
.NET Framework: 2.0
[PHP]
Core: 5.1.0 beta 3
IDE: PHPEdit
2nd IDE: Notepad
Favourite extensions: exif,gd2,mysql
Favourite PEAR packages: DB, XML_RSS, ID3
Favourite databases: SQLite, MySQL
From the mention of shockwave movie and all that, I'd guess running an executable.
Umm, there's system(), but everyone hates using that.
Umm, here's some stuff from MSDN, http://msdn.microsoft.com/library/de...e_handling.asp, specifically you'd want _execl to wexecvpe, then all the _spawn ones
Then you can pass stuff like the file to open via command line arguments for a bunch of programs. Passing IE a website as a param makes it open up and go to that website for example.
Sorry i forgot to mention i was using Borland c++ Builder...
The site you provided me above were related to Visual C++...
Does it make a difference? or are the commands the same...
If the commands are same, could someone please please post a sample snippet?
Thanx a lot for helping though..
..
..
Pritin
P.S :: I did not mean files with ASCII value, i meant executables...
I just started C++... hardly a month...
ShellExecute is also a good way....
[C++]
IDE: DevC++ 4.9.9.2 (GCC 3.4.2)
2nd compiler: g++ (GCC 3.4.3/4.0.0)
3rd compiler: Borland 5.5
[C#]
IDE: Microsoft Visual C# Express 2005
2nd IDE: SharpDevelop
2nd compiler: csc in Command Prompt
.NET Framework: 2.0
[PHP]
Core: 5.1.0 beta 3
IDE: PHPEdit
2nd IDE: Notepad
Favourite extensions: exif,gd2,mysql
Favourite PEAR packages: DB, XML_RSS, ID3
Favourite databases: SQLite, MySQL
Sorry to be such a pain in the neck, but isnt the previous post by "publikum" a Windows application? Or is it for the console and has a particular header file...
If im wrong please correct me...
Just in case my query still isnt clear,...
------------
Say for example im making a tutorial comprising of several separate shockwave or flash movies... I want to let the user open and view the movies, and when the user quits, i want to have stored the last movie viewed, and continue from there next time.
Please note :: Ive just started C++
-------------
Thanx people,
Pritin.
[email protected]
At the bottom of the page it tells you what header to use and what library to import. You can use ShellExecute in a console program, it's not restricted to Win32 applications.If im wrong please correct me...
Just because I don't care doesn't mean I don't understand.
EDIT: Minute late.
I believe (from the content of the afore-linked webpage) that ShellExecute is a premade function with the header file "shellapi.h" Info on this function (well, other than syntax details and use) is at the bottom of the link publikum mentioned.
This is in the FAQ.
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.
My compiler does not have shellapi.h -- it's turbo c++ ... very primitive... is there any other way..?
Could someone tell me how exactly it can be done using system("...")?
I saw it in FAQ, but it dint really work... it just took a lot of time compiling... screen turned black...(on execution) and returned back to normal... no exe was executed...
its a better idea to get a new compiler. try dev-c++
Free the weed!! Class B to class C is not good enough!!
And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi
The reason i try to avoid using dev c++ even though i have it, is because it gives lots of erreors... so i only use it to print the prog.
eg.
Gives me so many errors :: Something about using an inappropriate header file... void must return int.. and so on...Code:#include<iostream.h> void main() { cout << "Hello"; }
Someone plz help...
You should get used to this kind of error-messages. In the near future you won't find any compiler that compiles this kind of wrong code.Gives me so many errors :: Something about using an inappropriate header file... void must return int.. and so on...
Kurt
Well, in C++, headers only contain .h if they are (taking from someone else's post from who I forgot) non-standard or part of the original C library, and if they're part of the C library you add a "c" the beginning of the header file's name. stdio.h would become cstdio. iostream is part of the standard C++ library, and so it just "iostream". Dev-C++ calls files with .h "antiquitated" or "decaprecated". And errors that are fixed both make the program better and give you more knowledge about C++ in how code should be built.
EDIT: And yeah, main MUST return an int. When the program exits, main returns a value automatically to the system. Saying main is void violates the returning of the int, resulting in the error, resulting on more knowledge of how code is built.
It's Link, not linkofazeroth. The latter's just my username. The former's my online identity. Thank you.
So, instead of this code
you should tryCode:#include<iostream.h> void main() { cout << "Hello"; }
Code:#include <iostream> using namespace std; int main() { cout << "Hello, World!\n"; }
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.