command line arguments help

Please support our C advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Aug 2005
Posts: 15,661
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1500
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: command line arguments help

 
0
  #11
Apr 11th, 2007
It seems there may be some ambiguity in the requirements (and that occurs all too often) I assumed "occurrence of the characters" really meant the string supplied by the first argument. Example: replace all occurrences "Hello" with "Hello World". When the length of the string in the 2nd argunment is different than that in the 1st argument that means the size of the result string may be different than its original size by either shorting or lengthing the text read from the file.
Last edited by Ancient Dragon; Apr 11th, 2007 at 10:30 am.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Join Date: Sep 2006
Posts: 63
Reputation: rowly is an unknown quantity at this point 
Solved Threads: 3
rowly's Avatar
rowly rowly is offline Offline
Junior Poster in Training

Re: command line arguments help

 
0
  #12
Apr 11th, 2007
Originally Posted by Ancient Dragon View Post
It seems there may be some ambiguity in the requirements (and that occurs all too often) I assumed "occurrence of the characters" really meant the string supplied by the first argument. Example: replace all occurrences "Hello" with "Hello World". When the length of the string in the 2nd argunment is different than that in the 1st argument that means the size of the result string may be different than its original size by either shorting or lengthing the text read from the file.
aw zn this test is wrong ?!
c.exe abc def file.txt
argv[1]=abc
argv[2]=def
argv[3]=file.txt

input: abc
buffer = def
input :cajef
buffer= fdjef?!

it should bout :
c.exe abc def file.txt
argv[1]=abc
argv[2]=def
argv[3]=file.txt

input: abc
buffer = def
input :cajef
buffer= defef
or
input: abc
buffer = def
DarkCoder+
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,661
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1500
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: command line arguments help

 
0
  #13
Apr 11th, 2007
what text file are you using for your tests? Did your instructor give you one or did you make up your own ? If you can make up your own I would use a text file that you may already have lying around on your computer. That yway you can have something like this

c.exe Hello Worlds file.txt

instead of just nonsense characters.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Join Date: Sep 2006
Posts: 63
Reputation: rowly is an unknown quantity at this point 
Solved Threads: 3
rowly's Avatar
rowly rowly is offline Offline
Junior Poster in Training

Re: command line arguments help

 
0
  #14
Apr 11th, 2007
Originally Posted by Ancient Dragon View Post
what text file are you using for your tests? Did your instructor give you one or did you make up your own ? If you can make up your own I would use a text file that you may already have lying around on your computer. That yway you can have something like this

c.exe Hello Worlds file.txt

instead of just nonsense characters.
no champ, no there is no text file we just have to test...
./a.out hello world ....
thats all
DarkCoder+
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 6714 | Replies: 13
Thread Tools Search this Thread



Tag cloud for C
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC