Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > read line function outputs weird results

Reply
Thread Tools

read line function outputs weird results

 
 
CBFalconer
Guest
Posts: n/a
 
      02-14-2007
WStoreyII wrote:
>

.... snip ...
> i have actually got compiler warnings though for not having the
> casts on malloc.


Unless your compiler is faulty, those are probably due to failing
to #include <stdlib.h>, and have nothing to do with casts.

--
<http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt>
<http://www.securityfocus.com/columnists/423>

"A man who is right every time is not likely to do very much."
-- Francis Crick, co-discover of DNA
"There is nothing more amazing than stupidity in action."
-- Thomas Matthews

 
Reply With Quote
 
 
 
 
Barry Schwarz
Guest
Posts: n/a
 
      02-15-2007
On 14 Feb 2007 05:46:37 -0800, "WStoreyII" <(E-Mail Removed)>
wrote:

snip ~ 100 lines
>
>
>thanks for all of the help. i will try these out later. as far as
>the cast goes and using sizeof(char). i am new to c (obviously) and
>everything that i have read so far has said to use these methods. so
>as with anything there are those who are strict and those who are
>not. i have actually got compiler warnings though for not having the
>casts on malloc.
>
>thanks again for your help.


While quoting context is important, there is no need to quote a
hundred lines just to say thank you..


Remove del for email
 
Reply With Quote
 
 
 
 
WStoreyII
Guest
Posts: n/a
 
      02-15-2007
On Feb 14, 9:50 am, CBFalconer <(E-Mail Removed)> wrote:
> WStoreyII wrote:
>
> ... snip ...
> > i have actually got compiler warnings though for not having the
> > casts on malloc.

>
> Unless your compiler is faulty, those are probably due to failing
> to #include <stdlib.h>, and have nothing to do with casts.
>
> --
> <http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt>
> <http://www.securityfocus.com/columnists/423>
>
> "A man who is right every time is not likely to do very much."
> -- Francis Crick, co-discover of DNA
> "There is nothing more amazing than stupidity in action."
> -- Thomas Matthews



as you see in the original code above i did not fail to include
stdlib.h and gcc is my compiler and is one of the most popular c
compilers.

 
Reply With Quote
 
Richard Heathfield
Guest
Posts: n/a
 
      02-15-2007
WStoreyII said:

> On Feb 14, 9:50 am, CBFalconer <(E-Mail Removed)> wrote:
>> WStoreyII wrote:
>>
>> ... snip ...
>> > i have actually got compiler warnings though for not having the
>> > casts on malloc.

>>
>> Unless your compiler is faulty, those are probably due to failing
>> to #include <stdlib.h>, and have nothing to do with casts.

>
> as you see in the original code above i did not fail to include
> stdlib.h and gcc is my compiler and is one of the most popular c
> compilers.


gcc definitely gets this right (does *not* produce a diagnostic message
when malloc is properly used), so I can only presume you are using gcc
in C++ mode.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.
 
Reply With Quote
 
CBFalconer
Guest
Posts: n/a
 
      02-15-2007
WStoreyII wrote:
> CBFalconer <(E-Mail Removed)> wrote:
>> WStoreyII wrote:
>>
>> ... snip ...
>>> i have actually got compiler warnings though for not having the
>>> casts on malloc.

>>
>> Unless your compiler is faulty, those are probably due to failing
>> to #include <stdlib.h>, and have nothing to do with casts.

>
> as you see in the original code above i did not fail to include
> stdlib.h and gcc is my compiler and is one of the most popular c
> compilers.


gcc is many compilers. If you don't run it correctly it could be a
C++ compiler, which is a faulty C compiler.

--
<http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt>
<http://www.securityfocus.com/columnists/423>

"A man who is right every time is not likely to do very much."
-- Francis Crick, co-discover of DNA
"There is nothing more amazing than stupidity in action."
-- Thomas Matthews


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with displaying command line outputs John Smith Ruby 2 04-20-2011 02:47 PM
Read a file line by line and write each line to a file based on the5th byte scad C++ 23 05-17-2009 06:11 PM
How to read a text file line by line and remove some line kaushikshome C++ 4 09-10-2006 10:12 PM
Beginner: read $array with line breaks line by line Marek Stepanek Perl Misc 12 09-02-2006 10:27 AM
Read a file line by line with a maximum number of characters per line Hugo Java 10 10-18-2004 11:42 AM



Advertisments