473,378 Members | 1,162 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

problems with system()

Hi, I've been having some problems with system calls.

When I create a simple file like this
int main(int argc, char *argv[])
{
int x;
printf("Checking if processor is available...");
if(system(NULL))
puts ("Ok");
else
exit (1);
x = system("date");
printf("The value returned was: %d.\n", x);

return 0;
}

everything works fine and all the functions I enter are called and executed.
But when I include the same code into a larger programme (this is where I
need to call another function multiple times) system() doesn't execute the
function and just returns some value like 1280 or 32768.
Does anybody know what the problem could be?

Kind regards,
Jens

May 31 '07 #1
5 1491
Jens Kleine wrote:
Hi, I've been having some problems with system calls.

When I create a simple file like this
int main(int argc, char *argv[])
{
int x;
printf("Checking if processor is available...");
if(system(NULL))
puts ("Ok");
else
exit (1);
x = system("date");
printf("The value returned was: %d.\n", x);

return 0;
}

everything works fine and all the functions I enter are called and
executed. But when I include the same code into a larger programme
(this is where I need to call another function multiple times)
system() doesn't execute the function and just returns some value
like 1280 or 32768. Does anybody know what the problem could be?
Yes, somebody in the newsgroup dedicated to your compiler or your OS
should definitely be able to help you. Calls to 'system' are
implementation- and platform-specific. Their side effects and the
return value meanings are not defined by the Standard if the argument
is not a null pointer.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
May 31 '07 #2
Victor Bazarov <v.********@comAcast.netwrote:
Yes, somebody in the newsgroup dedicated to your compiler or your OS
should definitely be able to help you. Calls to 'system' are
implementation- and platform-specific. Their side effects and the
return value meanings are not defined by the Standard if the argument
is not a null pointer.
I know but I hoped there was some known c++ dependent conflict with the call
of other functions.

May 31 '07 #3
Jens Kleine wrote:
Victor Bazarov <v.********@comAcast.netwrote:
>Yes, somebody in the newsgroup dedicated to your compiler or your OS
should definitely be able to help you. Calls to 'system' are
implementation- and platform-specific. Their side effects and the
return value meanings are not defined by the Standard if the argument
is not a null pointer.

I know but I hoped there was some known c++ dependent conflict with
the call of other functions.
Conflict? Like what?
May 31 '07 #4
On May 31, 4:53 pm, "Victor Bazarov" <v.Abaza...@comAcast.netwrote:
Jens Kleine wrote:
Hi, I've been having some problems with system calls.
When I create a simple file like this
int main(int argc, char *argv[])
{
int x;
printf("Checking if processor is available...");
if(system(NULL))
puts ("Ok");
else
exit (1);
x = system("date");
printf("The value returned was: %d.\n", x);
return 0;
}
everything works fine and all the functions I enter are called and
executed. But when I include the same code into a larger programme
(this is where I need to call another function multiple times)
system() doesn't execute the function and just returns some value
like 1280 or 32768. Does anybody know what the problem could be?
Yes, somebody in the newsgroup dedicated to your compiler or your OS
should definitely be able to help you.
I wouldn't be sure of it. A short summary of his posting is
"Here's some code that works, but I've got some different code
which doesn't. What's wrong with the code I'm not showing you?"

I know that even if the platform were Unix (which I know very,
very well), I couldn't do more than guess (problem with $PATH?)
with the small amount of data given.
Calls to 'system' are implementation- and platform-specific.
Their side effects and the return value meanings are not
defined by the Standard if the argument is not a null pointer.
Maybe in the code he's not showing us, the argument is a null
pointer:-).

You're right, of course, that he really is asking in the wrong
place. But regardless of where he asks, he's going to have to
give a bit more information if he wants an answer.

--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

Jun 1 '07 #5
James Kanze wrote:
[..]
You're right, of course, that he really is asking in the wrong
place. But regardless of where he asks, he's going to have to
give a bit more information if he wants an answer.
The point is that in a proper place folks would know how to lead
him to providing the right information by asking the right
questions (like about $PATH variable or some such)...

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Jun 1 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Eva | last post by:
Hi, I wanted to know how i can enter values into a specific column of a listview. I have tried the following code but this seems to enter all my values into the first column!!! Can anyone...
0
by: Jesper Stocholm | last post by:
I am using the example as the basis for an application I am currently writing. The setup consists of two applications (client and server) that talk to each other thru TCP. I have no problems...
10
by: BBFrost | last post by:
We just recently moved one of our major c# apps from VS Net 2002 to VS Net 2003. At first things were looking ok, now problems are starting to appear. So far ... (1) ...
17
by: Lloyd Sheen | last post by:
This IDE is driving me nuts. I needed another button so I copied an existing one, changed the Text and the id and position by drag and drop. Well then I run and get the following: Control...
21
by: matvdl | last post by:
I have a system that was originally developed in asp - the pages are saved in SQL (there are over 10,000 pages) and saved to a temp directory in the server when requested by a client. I have...
2
by: Joel D. Kraft | last post by:
I've been very happy with the performance and new features of my site since we converted to ASP.NET 2.0 beta 2. I have noticed a couple of interesting problems, though, which I am trying to...
0
by: neoret | last post by:
Hello. I have developed an application (an office addin).The application works fine with no error messages on my devoping machine (that machine is not connected to any domains). I have...
0
by: neoret | last post by:
Hello. I have developed an application (an office com addin).The application works fine with no error messages on my devoping machine (that machine is not connected to any domains). I have...
9
by: =?Utf-8?B?SG93YXJkIFNtaXRo?= | last post by:
I am using VC++ 6.0 (with SP5 installed). When using WinXP this is with SP2 installed. I am developing an instrumentation system comprising a set of networked PCs connected using TCP/IP TCP links....
34
by: Alexnb | last post by:
Gerhard Häring wrote: No, it didn't work, but it gave me some interesting feedback when I ran it in the shell. Heres what it told me: Traceback (most recent call last): File...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.