How would I test this code on a file on the command line? I believe you use something like a.out? This file name is csvgetline.c
The book also states that there are problems with this implementation, would anyone know by just looking at it?
How would I test this code on a file on the command line? I believe you use something like a.out? This file name is csvgetline.c
I'm no C programmer, but I think I know some basics
First of all, you'll need to compile this code, try
or
#invoke executable to read from standard input
Example:
#invoke executable to read from a file
Example:
Quote:
Originally Posted by totoro125
The book also states that there are problems with this implementation, would anyone know by just looking at it?
Not sure, but I'd say it's
1. the processing of pre-defined number of fields (?) even if the actual number of fields exceeds that limit and thus producing wrong output
I don't know why, but during some testing I found out it will handle 24 fields, but fail when there are >25 fields.
2. the processing of pre-defined line length even if the actual line length exceeds that limit and thus producing wrong output
which I'd summarize as "no error checking".
Demo for "too many fields":
Demo for "too long line":
This User Gave Thanks to junior-helper For This Post:
It also can't handle escaped things like "this is a string with a \" mark inside it" But that may not be a bug if you don't consider that valid, since it isn't actually causing a crash.
Basically, they left out all the error checking for brevity.
I'm no C programmer, but I think I know some basics
First of all, you'll need to compile this code, try
or
#invoke executable to read from standard input
Example:
#invoke executable to read from a file
Example:
Not sure, but I'd say it's
1. the processing of pre-defined number of fields (?) even if the actual number of fields exceeds that limit and thus producing wrong output
I don't know why, but during some testing I found out it will handle 24 fields, but fail when there are >25 fields.
2. the processing of pre-defined line length even if the actual line length exceeds that limit and thus producing wrong output
which I'd summarize as "no error checking".
Demo for "too many fields":
Demo for "too long line":
Thank you! You have been such a great help to me lately ^^
Hi everybody,
i've been googling for ages now and gotten kinda desperate... The question, however, might be rather trivial for the experts: What is it exactly, i.e. physically, the POSIX function (for a file) "lseek" does? Does it trigger some kind of synchronization on disk? Is it just for the... (4 Replies)
Hi
I'm trying to implement CAPWAP protocol for my application.i'm able to configure my server side but i'm getting error at client(WTP) side as IOCTL error.while running the command
#./WTP /mnt/cf/capwap/
: wlan2
Starting WTP...
# WTP Loads... (0 Replies)
Hi all,I'm reading <Advanced programming in the UNIX environment>,that book asked the reader to implement a function which has same functions with dup2 without calling fcntl.Could anyone give me a tip?Any help will be appreciated.:) (8 Replies)
Hey Guys
Some of my friends have got together and we are trying to write a basic kernel similar to Linux. I am trying to implement the malloc function in C and I am using a doubly linked list as the primary data structure. I need to allocate memory for this link list (duh...) and I don't feel... (2 Replies)
Hey Guys
I am trying to implement the malloc function for my OS class and I am having a little trouble with it. I would be really grateful if I could get some hints on this problem.
So I am using a doubly-linked list as my data structure and I have to allocate memory for it (duh...). The... (1 Reply)
Hi,
I am accepting a string from user. compare this output with the awk output as below...
echo "\n\n\tDay : \c"
read day
awk '{ if($day == $2) { if ($mon == $1) { print "Yes" }}}' syslog.txt
I am getting the follwoing error
awk: Field $() is not correct.
The input line... (5 Replies)
I want to implement my own simple multi tasking shell in Unix which will take care of redirection (<, >, >>) and piping.
I am just unable to get a concrete idea of how exactly I have to start. I have several books...some are..
1. Maurice Bach- Design Of Unix Operating System
2. Richard... (3 Replies)