LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-16-2006, 02:11 PM   #1
docetes
LQ Newbie
 
Registered: Jun 2005
Posts: 12

Rep: Reputation: 0
does a system call return value??


does a system call return value??

if not how would i get the menu choice to return some value
Code:
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#define script "dialog --backtitle \"Linux Shell Script Tutorial\" \
--title \"Main Menu\" --menu \
\"Move using [UP] [DOWN],[Enter] to Select\" 15 50 3\
1 \"Shows Date and Time\" 2 \"To see calendar\" 3 \"To start vi editor\" "



int main(int arg1, char *arg2[])
{
int a;
a=system(script);
printf("hello");
printf("%d",a);
return 0;
}
thanks for your time
 
Old 03-16-2006, 04:37 PM   #2
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
System returns the exit value of the called application.
 
Old 03-16-2006, 05:40 PM   #3
thewonka
Member
 
Registered: Feb 2005
Location: Cambs UK/San Diego US/Tijuana MX
Distribution: Slackware/Debian!
Posts: 53

Rep: Reputation: 15
and the exit value is ( just in case somebody reads this and doesnt know ) used to know what happend when the app terminated, you can as in the sample above the "Return 0" or "exit 0" will return a 0 value ( or BIG OK ), if you app needs to stop becuse of a problem ( missing params, file access, etc. ) you can exit with a different code, like exit 1.

You get the idea
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Retain Server Connection Up, If Client Break, write system call return SIGPIPE anandss2004 Programming 2 10-24-2005 12:16 AM
Is it possible to use system() and get the return value from the system call newguy21 Programming 1 08-11-2004 01:37 PM
How can get values return from a system call quenn Programming 1 09-16-2003 11:05 PM
Problem with accept() socket call which doesn't return jph Programming 4 08-06-2003 06:30 AM
Problem with accept() call which doesn't return jph Linux - General 0 07-28-2003 04:34 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:35 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration