PLZ help in using fread,fwrite ..

This is a discussion on PLZ help in using fread,fwrite .. within the C Programming forums, part of the General Programming Boards category; Hello,This is my first pardon me if make any mistakes can any 1 tell me how to use fread ...

  1. #1
    Registered User
    Join Date
    Jan 2009

    PLZ help in using fread,fwrite ..

    Hello,This is my first pardon me if make any mistakes

    can any 1 tell me how to use fread from stdin(FROM CONSOLE)

    for example: i want to take 100 numbers as input ..and also perform some operations on them..
    how do i do that ? because fread takes BINARY INPUT...can any 1 plz help me in this aspect ?

    PS: The reason i am using fread instead of scanf is because i heard that fread is much faster than i want to extend this to very large input/

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Take a look at the Enormous Input Test thread, especially towards the end. The code is C++ but most of the suggestions are also C.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    I think you'll find that typing in 1000 and reading with fscanf is considerably easier than
    typing in alt-000 alt-000 alt-003 alt-232 and using fread.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. can any1 plz make this assignment
    By jean in forum C Programming
    Replies: 17
    Last Post: 05-13-2009, 09:19 PM
  2. [Request] Need Help Plz
    By TylerD in forum Tech Board
    Replies: 4
    Last Post: 01-03-2009, 08:54 AM
  3. Anyone plz help me
    By Rose_Flowers in forum A Brief History of
    Replies: 1
    Last Post: 09-17-2003, 12:01 PM
  4. plz help me fix this problem
    By Joe100 in forum C++ Programming
    Replies: 8
    Last Post: 07-13-2003, 01:25 PM
  5. help plz plz
    By nsssn73 in forum C++ Programming
    Replies: 2
    Last Post: 06-03-2002, 08:44 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21