| | |
command line arguments help
Please support our C advertiser: Programming Forums - DaniWeb Sister Site
![]() |
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.
•
•
•
•
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.
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+
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.
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.
•
•
•
•
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.
./a.out hello world ....
thats all
DarkCoder+
![]() |
Similar Threads
- Command Line Arguments (C#)
- To fetch data through command line arguments (C++)
- HELP!!!need help with command line arguments and creating a package in java. HELP!!!! (Java)
- command line arguments (C++)
- Command-line Arguments. (C++)
Other Threads in the C Forum
- Previous Thread: Function declaration error
- Next Thread: Handling I/O redirections in my shell.
Views: 6711 | Replies: 13
| Thread Tools | Search this Thread |
Tag cloud for C
* api append array arrays bash binarysearch changingto char character cm copyanyfile copypdffile createcopyoffile createprocess() csyntax database directory drawing dynamic executable execv feet fgets file floatingpointvalidation fork frequency function functions getlogicaldrivestrin givemetehcodez global graphics gtkwinlinux histogram homework i/o ide include infiniteloop initialization input interest intmain() iso keyboard kilometer lazy license linked linkedlist linux list lowest matrix meter microsoft mqqueue mysql oddnumber odf open openwebfoundation overwrite pause pdf pointer pointers posix power program programming pyramidusingturboccodes read recursion recv recvblocked reversing scheduling segmentationfault send single socketprogramming spoonfeeding standard strchr string student suggestions system test testautomation testing unix urboc user whythiscodecausesegmentationfault win32api windowsapi






