![]() |
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 |
| Getting error in command line arguments | sunitachoudhury | Shell Programming and Scripting | 9 | 01-14-2009 09:13 PM |
| command line arguments | skooly5 | Shell Programming and Scripting | 1 | 04-07-2008 04:49 AM |
| i want to list all command line arguments except | naree | Shell Programming and Scripting | 3 | 03-31-2008 12:11 PM |
| arguments in command line | rrs | UNIX for Dummies Questions & Answers | 6 | 07-28-2006 07:44 AM |
| Command Line Arguments | roba909 | UNIX for Dummies Questions & Answers | 7 | 01-19-2006 01:46 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
command line arguments
Hi
How to pass multi line text as a command line argument to a program. (i.e) ./a.out hi this is sample 0 file1 where hi this is sample should be stored in argv[1] 0 in argv[2] and so on... |
|
||||
|
Code:
kcsdev:/home/jmcnama> cat a.c
int main(int argc, char *argv[])
{
int i;
for (i=0;i<=argc;i++) printf("%s\n", argv[i]);
return 0;
}
kcsdev:/home/jmcnama>cc a.c
kcsdev:/home/jmcnama> a.out "simple test" "b" '"'
a.out
simple test
b
"
kcsdev:/home/jmcnama> a.out "simple test" "b" \"
a.out
simple test
b
"
This is a shell question ,not a C question, IMO. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|