![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
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 |
| echo | debasis.mishra | Shell Programming and Scripting | 0 | 03-28-2006 12:35 AM |
| How to set echo on | siegfried | Shell Programming and Scripting | 1 | 11-18-2005 01:56 AM |
| What does echo ^[[r do? | hamsasal | UNIX for Advanced & Expert Users | 1 | 07-24-2005 01:14 PM |
| echo with \n | whatisthis | UNIX for Dummies Questions & Answers | 3 | 05-18-2005 10:59 AM |
| echo ????? | nguda | UNIX for Dummies Questions & Answers | 1 | 06-30-2003 04:02 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
echo help
i found this code in the book but was unable to execute it.
/*myecho -- echo command line arguments */ main(int argc, char **argv) { while(--argc > 0) printf("%s ", *++argv); printf("\n"); } this is another program that would invoke the one above char * const argin[] = {"myecho", "hello", "world", (char *)0}; execvp(argin[0], argin); the output suppose to display "hello world" i tried putting the bottom portion in another main function, but it did not work. help please. thank you |
|
||||
|
i'm using gcc.
compiling on a remote computer using ssh. the first main program i saved it as myecho.c the second main program(the bottom portion) i called it caller.c when i gcc caller.c then a.out, i didn't get anything. It's like it's not calling anything. o...and ./myecho doesn't make any difference thanks |
|
||||
|
a ha...i found the problem. instead of "myecho" i typed it as "myecho.c".
hey thanks alot for taking the time to answer. by the way, i didn't run it as ./ i jut runned it regularly and it still worked. instead of ./a.out i just simply used a.out and it run just fine. what's the point of using ./ ? thanks |
|
|||||
|
That must mean that "." is in your PATH, or you are in a directory that is in your path. "./program" will execute the "program" in your current directory.
Many people will remove "." (the current directory) from their PATH variable for security reasons, and others will do it just to be safe. Many normal users can leave "." in their PATH, as long as they're cautious of where they are and what they're executing. Also, if you name a program "test", you'll want to give a full path to it, since "test" already exists in many shells as a builtin command, or as a system binary. In that case executing "test" and executing "./test" will be two different programs. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|