![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| querry ..including external shell script | mobydick | Shell Programming and Scripting | 3 | 05-22-2008 09:31 AM |
| Repeating variables in the code | mahalakshmi | Shell Programming and Scripting | 1 | 02-08-2007 07:33 AM |
| Reading a path (including ref to shell variable) from file | lojzev | Shell Programming and Scripting | 1 | 09-11-2006 12:05 AM |
| how to convert from korn shell to normal shell with this code? | forevercalz | Shell Programming and Scripting | 21 | 11-23-2005 02:18 AM |
| server based Including additional code > Lycos way | valentijnb | UNIX for Dummies Questions & Answers | 1 | 07-05-2003 07:54 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
including shell env variables into C code
Hey, I'm brushing up on C code and I'm trying to incorporate the shell environmental variables into standard ansi C code.
For example I just want to do the equivalent of --echo $PATH-- and implement that in standard ansi C code. How would I do that? Thanks |
|
||||
|
Quote:
Code:
/* ShellCommsInC.c: sample program to see how shell commands can be incorporated
in standard C ANSI code
*/
# include <stdio.h>
int main ( void )
{
printf("\n* * * * * * * * * * * * * * * *\n") ;
printf("This is a test for incorporating shell comm's into ANSI C code\n") ;
system("echo") ;
system("echo '$PATH' is: $PATH") ;
system("echo") ;
system("echo '$HOME' is: $HOME") ;
system("echo") ;
system("echo '$USER' is: $USER") ;
printf("\nAnd so on..\n") ;
printf("\n* * * * * * * * * * * * * * * *\n") ;
return 0 ;
}
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|