Can I use this code to open Internet explorer if i compile the program file and use the .exe file of the program if yes then pls also tell me the header file.. - system("C:\Program Files\Internet Explorer\IEXPLORE.EXE");
I was trying to make this code but it is not working as I want it to work.. The compiled file displays "Bad command or file name" - #include<stdlib.h>
-
void main(void)
-
{
-
for(;;)
-
{
-
system("C:\Program Files\Internet Explorer\IEXPLORE.EXE");
-
-
}
-
}
-
11 31388
Review the documentation for system. (These are general code hygiene suggestions; they probably won't lead to a solution to your problem.) - It has a return value that you should be checking.
- Consider whether its behavior when passed NULL would be helpful to you.
What happens when you execute your system command string in a Command Prompt window? - C:\Documents and Settings\snehil> C:\Program Files\Internet Explorer\IEXPLORE.EXE
It's also possible you'll have to escape your backslashes in the command (you have to do this in other languages I know).
Mark.
Banfa 9,065
Expert Mod 8TB
It is more than possible, it is necessary. As with many other C like languages in C the character '\' has a special meaning inside a string, it is the escape sequence. Depending on what follows it made have a special meanins, i.e. '\n' is the newline character, '\0' is the zero character (the terminator). If it has no special meaning then it take is ignored '\q' is the character 'q'.
If you want a \ character then you need the sequence '\\'.
ok.. now the code is - #include<stdlib.h>
-
void main(void)
-
{
-
for(;;)
-
{
-
system("C:\\Program Files\\Internet Explorer\\IEXPLORE.EXE");
-
-
}
-
}
-
but still the same problem:
and at donbock.. when I execute the command in command prompt
this is the output..
i dont have much knowledge of advanced programing as I am still a beginer...
I saw this code on net and I am just keen to know if it works or not...
from where I saw tyhis code header file was not there so pls also tell if this header file is correct...
bcoz maybe system function is also in process.h m not sure though...
There's a thread about 'execute php' at 12 jul. Error message "C:\program is not recognized" gives you a hint - the space is interpreted as a separator, enclose the full file name in quotes. - system("\"C:\\Pr...
system() is prohibited (and dirty) on Windows (see MSDN)
use Shell apis.
Banfa 9,065
Expert Mod 8TB
Also not true.
For Visual C++ 2008, the latest version there are the following pages on the system function Implemetation Defined Behaviour system, _wsystem - the actual help on the function
In neither of those 2 places does it say that system is prohibited. Further more Visual C++ 2008 is an ANSI C compliant compiler and to be such it has to fully implement the Standard C Library that includes the system() function.
If you want to make statements like that you need to back them with hard evidence such as a link or quote.
but i still havnt found wat I ws looking for....
yeah, you can launch internet explorer.
your code was about right...
1st. main is supposed to be an int (not void) and should return a number (such as 0).
2nd. a "\" in a string must be written as "\\"
3rd. in many systems (well, mine) you must make the directory into "Shortfilename" because it does not contain spaces.
ex. C:\\PROGRA~1\\INTERN~1\\IEXPLORE.EXE
but yes, your code holds the right idea
PS. your header worked fine for me.
thanx.. it worked like a charm.. :)
ok 1 more query...
in this code... IE again opens when i close one window of IE...
is there a code to forcefully open multiple instances of IE window at a same time in an infinite loop... ?
yes, but it will run so fast that it will make your computer flip in a second. so do not run it without saving all data first. i repeat that: DO NOT RUN IT WITHOUT SAVING ALL DATA
but instead of the system function, i would recommend ShellExecute. it requires <windows.h>
here is an example
ShellExecute( NULL, "open", "C:\\Progra~1\\Intern~1\\IEXPLORE.EXE","","C:\ \", SW_SHOW);
This is much more versatile.
-you do not need to use ShortFileName. Program Files\Internet Explorer works perfectly fine.
-arguments for the program-to-be-run are accepted in the argument i left blank.
-also, you can do SW_SHOW: window is shown; SW_HIDE: window is hidden; etc
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Penn Markham |
last post by:
Hello all,
I am writing a script where I need to use the system() function to call
htpasswd. I can do this just fine on the command line...works great
(see attached file, test.php). When my...
|
by: Randy Jackson |
last post by:
I'm attempting to debug some code that uses the System function. When the
function is called, it returns Error 1. Does anyone know what that error
might be, or where I can find a list of error...
|
by: praba kar |
last post by:
Dear All,
In Php If I send a command to system function
then It will return 1 on success and 0 on failure. So
based upon that value I can to further work.
But In Python If I send a command...
|
by: Harsh_forC |
last post by:
hello folks,
when i'm using 'System' funtion in TC, perror function is outputting
the
following error msg..." Not enough memory"
wat does it mean? how to get rid of this situaiton?
plz help me...
|
by: SF |
last post by:
Hello All,
In a windows C learning project I am wokring on I use the system
function to run a command, I want to suck the results into a vairable.
The system function seems to only return an...
|
by: BHARAT MEHTA |
last post by:
Hi Guys,
I am little new to C. I wish to know the way to use the 'system'
function. I mean I know that the function is used to run an external
DOS command but every time I use it it returns -1...
|
by: bob |
last post by:
Which is faster - a call to a system function or a call to a library
function?
|
by: nnandini8 |
last post by:
Hello Guys,
I have a doubt in system() function. I need to implement
the certain command line arguements in a program.
For Example
if I type "dnaml" at command line and press enter then it will...
|
by: Gary Wessle |
last post by:
hi
how can I use $wc -l file_name which puts out the number of lines.
#include <cstdlib>
using std::system;
system (wc -l file_name)
I get...
|
by: rajarora |
last post by:
Hi ,
Is there anybody who have any idea of any System Function in C/C++ for Sun-Solaris (unix) platform which can serve the alternative of execl() system function.
Actually I am calling a...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |