473,386 Members | 1,715 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,386 software developers and data experts.

Getting a return code of 128 from ANSI C function - What does 128 mean?

Sam
In our C++ program, we are using the system call to
execute another C++ program synchronously. The program
executed by system runs without error and returns back a
0.

Under conditions we cannot determine, the system function
will return back a 128 even though the command executed
exited with a return code of 0.

I found in the Winerror.h, that 128 means

"128 : There are no child processes to wait for.
ERROR_WAIT_NO_CHILDREN "

Is the 128 returned back by the system function the same
value as the one referenced in Winerror.h?
Nov 16 '05 #1
2 5938
Sam wrote:
In our C++ program, we are using the system call to
execute another C++ program synchronously. The program
executed by system runs without error and returns back a
0.

Under conditions we cannot determine, the system function
will return back a 128 even though the command executed
exited with a return code of 0.


Which system function !???

Do you mean "system" !?
http://msdn.microsoft.com/library/en...crt_system.2c_.
_wsystem.asp

Normally it should only return 0 or -1... and the real error is in "errno".
You can also look at the CRT-source to see what is called and what is
returned.

But generally I would suggest to use CreateProcess, to have full control
over the API.

--
Greetings
Jochen

Do you need a memory-leak finder ?
http://www.codeproject.com/useritems/leakfinder.asp
Nov 16 '05 #2
Sam
Thanks for the reply Jochen,

Yes, I am referring to the stdlib.h function system.

Here is what the MS Help page says about the return value
for their version of system

"...If command is NULL and the command interpreter is
found, the function returns a nonzero value. If the
command interpreter is not found, it returns 0 and sets
errno to ENOENT. If command is not NULL, system returns
the value that is returned by the command interpreter. It
returns the value 0 only if the command interpreter
returns the value 0. A return value of - 1 indicates an
error, and errno is set to one of the following
values: ..."

The second part where the command is not NULL applies to
us. For some reason, the programmer who originally wrote
this code is flagging the return value of system as an
error if it is greater than 8. However, as the help page
indicates, -1 normally indicates an error.

9 times out of 10, the retcode of the function is 0.
However, every 10 th time or so we get an error code 128
which causes or process to error out. Our management
wants to know what is 128 and what the solution is.

I guess what I am trying to get confirmation that 128
means "There are no child processes to wait for." which is
kind of a DUH type of ret code and can be ignored. After
all, if control is reverting back to the parent process,
the child process should be gone.

Let me know if you know the answer,

Thanks,

Sam

-----Original Message-----
Sam wrote:
In our C++ program, we are using the system call to
execute another C++ program synchronously. The program
executed by system runs without error and returns back a 0.

Under conditions we cannot determine, the system function will return back a 128 even though the command executed
exited with a return code of 0.
Which system function !???

Do you mean "system" !?
http://msdn.microsoft.com/library/en-

us/vclib/html/_crt_system.2c_._wsystem.asp

Normally it should only return 0 or -1... and the real error is in "errno".You can also look at the CRT-source to see what is called and what isreturned.

But generally I would suggest to use CreateProcess, to have full controlover the API.

--
Greetings
Jochen

Do you need a memory-leak finder ?
http://www.codeproject.com/useritems/leakfinder.asp
.

Nov 16 '05 #3

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

Similar topics

242
by: James Cameron | last post by:
Hi I'm developing a program and the client is worried about future reuse of the code. Say 5, 10, 15 years down the road. This will be a major factor in selecting the development language. Any...
29
by: pmatos | last post by:
Hi all, Sometimes I have a function which creates an object and returns it. Some are sets, other vectors but that's not very important. In these cases I do something like this: vector<int> *...
10
by: LaEisem | last post by:
On-the-job, I have "inherited" a lot of old C language software. A question or two about when "casting" of null pointer constants is needed has occurred during behind-the-scenes cleanup of some...
4
by: ItsMe | last post by:
Hi Guyz, I'm unable to understand this (AddressOf) error??? In VB6 I have two functions: ---------------------------- Public Function ImageFirstImageCallback(ByVal hWnd As Integer, ByVal...
10
by: steve yee | last post by:
the code is like this: class Asn_T { public: DataType_T m_data; }; class MyData {
34
by: priyanka | last post by:
Hi, I was wondering if we could parse or do something in the executable( whose source language was C). How can I use some scripting language like perl/python to find out the information about...
232
by: robert maas, see http://tinyurl.com/uh3t | last post by:
I'm working on examples of programming in several languages, all (except PHP) running under CGI so that I can show both the source files and the actually running of the examples online. The first...
41
by: Jim | last post by:
Hi guys, I have an object which represents an "item" in a CMS "component" where an "item" in the most basic form just a field, and a "component" is effectively a table. "item" objects can be...
185
by: jacob navia | last post by:
Hi We are rewriting the libc for the 64 bit version of lcc-win and we have added a new field in the FILE structure: char *FileName; fopen() will save the file name and an accessor function will...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
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...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
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 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.