The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 09-25-2006
flounder flounder is offline
Registered User
  
 

Join Date: Jun 2002
Location: PA
Posts: 17
Return value (int) from main to calling shell

What is the sytax to return an int from C program main back to calling shell?

Code:
#!/usr/bin/ksh 

typeset -i NO_RECS

$NO_RECS=process_file

# Process file is a C program that is set up to return an int from main. The
#program complies with no issues, but an error is generated when the shell
#calls the program. Is the syntax correct to return the int value to a shell
#variable?

Here is the C program:

Code:
int main(argc,argv)
{

int no_recs_tot ;

/* This is just a function within the c program that returns the int value */

no_recs_tot = bld_detail(v_out_path,v_in_path,inrec_cnt,v_src_data_dt);
 
return (no_recs_tot);

} /* End main */


Last edited by blowtorch; 09-25-2006 at 11:09 PM.. Reason: add code tags