943,808 Members | Top Members by Rank

Ad:
  • C Discussion Thread
  • Unsolved
  • Views: 11991
  • C RSS
You are currently viewing page 2 of this multi-page discussion thread; Jump to the first page
Apr 11th, 2007
0

Re: command line arguments help

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.
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,950 posts
since Aug 2005
Apr 11th, 2007
0

Re: command line arguments help

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
Reputation Points: 10
Solved Threads: 3
Junior Poster in Training
rowly is offline Offline
65 posts
since Sep 2006
Apr 11th, 2007
0

Re: command line arguments help

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.
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,950 posts
since Aug 2005
Apr 11th, 2007
0

Re: command line arguments help

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
Reputation Points: 10
Solved Threads: 3
Junior Poster in Training
rowly is offline Offline
65 posts
since Sep 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C Forum Timeline: Function declaration error
Next Thread in C Forum Timeline: Handling I/O redirections in my shell.





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC