W
Walter Dnes (delete the 'z' to get my real address
A long time ago, in a place far away, there was an OS called DOS that
had standard numeric return codes. Regardless of the programming
language used, the same error return codes were supposed to be used. See
http://www.felgall.com/doserr.htm for a larger list. It starts like so...
# 1 Invalid Function Code
# 2 File Not Found
# 3 Path Not Found
# 4 No Handles Available, Too Many Open Files
# 5 Access Denied
# 6 Invalid File Handle
As per the subject of my post, are there any standards for error
return codes in C? Right now, I'm using 1 for lack of anything better,
unless there's some over-riding reason. Here's the start of a typical
program...
#include <stdio.h>
int main(int argc, char *argv[])
{
unsigned long int accumulator, b1[256];
float percent;
int i, pixel;
FILE *input_file, *output_file;
if(argc != 3){
printf(" Correct usage:\n %s input_filename output_filename\n", argv[0]);
return 1;
}
if((input_file = fopen(argv[1], "rb")) == NULL){
printf("Error opening %s for input\n", argv[1]);
return 1;
}
if((output_file = fopen(argv[2], "w")) == NULL){
printf("Error opening %s for output\n", argv[2]);
return 1;
had standard numeric return codes. Regardless of the programming
language used, the same error return codes were supposed to be used. See
http://www.felgall.com/doserr.htm for a larger list. It starts like so...
# 1 Invalid Function Code
# 2 File Not Found
# 3 Path Not Found
# 4 No Handles Available, Too Many Open Files
# 5 Access Denied
# 6 Invalid File Handle
As per the subject of my post, are there any standards for error
return codes in C? Right now, I'm using 1 for lack of anything better,
unless there's some over-riding reason. Here's the start of a typical
program...
#include <stdio.h>
int main(int argc, char *argv[])
{
unsigned long int accumulator, b1[256];
float percent;
int i, pixel;
FILE *input_file, *output_file;
if(argc != 3){
printf(" Correct usage:\n %s input_filename output_filename\n", argv[0]);
return 1;
}
if((input_file = fopen(argv[1], "rb")) == NULL){
printf("Error opening %s for input\n", argv[1]);
return 1;
}
if((output_file = fopen(argv[2], "w")) == NULL){
printf("Error opening %s for output\n", argv[2]);
return 1;