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 post...so pardon me if make any mistakes can any 1 tell me how to use fread ...

  1. #1
    Registered User
    Join Date
    Jan 2009
    Posts
    71

    PLZ help in using fread,fwrite ..

    Hello,This is my first post...so 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 others..so i want to extend this to very large input/

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,436
    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.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,451
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

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 Cprogramming.com
    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