reading words using fread

This is a discussion on reading words using fread within the C Programming forums, part of the General Programming Boards category; then what is it?? this is really weird...

  1. #16
    Registered User
    Join Date
    Jan 2008
    Posts
    569
    then what is it?? this is really weird

  2. #17
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,006
    I think you need to post more code and perhaps attach an input file.
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  3. #18
    Registered User
    Join Date
    Jan 2008
    Posts
    569
    I was wondering if because the file was a UNIX type.. it does not have any file extensions, any .txt or anythng

    and the input file is 22MB so I can't attach it

  4. #19
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,006
    Okay, I only tried with a 32MB file, so I'm still guessing that it's part of the code that you haven't posted.
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  5. #20
    Registered User
    Join Date
    Jan 2008
    Posts
    569
    here's a testing code that I used

    Code:
    int main(){
    
      FILE* fp = fopen("BIG", "r");
      char* word;
      while (NULL != (word = getword(fp))){
        printf("%s\n", word);
       }
       return 0;
    }
    so you wan't me to post the 22 MB file?

  6. #21
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,006
    Quote Originally Posted by -EquinoX- View Post
    so you wan't me to post the 22 MB file?
    Naw, I'm sure interested parties might create their own.
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  7. #22
    Registered User
    Join Date
    Jan 2008
    Posts
    569
    so what should I do here? it's weird that it works using other files...but there's this file called BIG that doesn't works

  8. #23
    Registered User
    Join Date
    Oct 2001
    Posts
    2,129
    Post the whole code.

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C String Problem: Not reading end of string
    By sedavis4 in forum C Programming
    Replies: 5
    Last Post: 11-17-2008, 09:29 PM
  2. using fread on stdin
    By nadroj in forum C Programming
    Replies: 29
    Last Post: 10-23-2008, 02:03 PM
  3. reading words line by line from a file
    By -EquinoX- in forum C Programming
    Replies: 3
    Last Post: 05-04-2008, 12:34 AM
  4. Sorting a file with a lot of words.
    By samus250 in forum C Programming
    Replies: 28
    Last Post: 04-27-2008, 01:36 PM
  5. Need help in debugging this code
    By jaggesh in forum C Programming
    Replies: 4
    Last Post: 02-09-2008, 07:47 AM

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