help with file again :P

This is a discussion on help with file again :P within the C++ Programming forums, part of the General Programming Boards category; hello again thanks for helping me out in all stuffs everyone : ) but now i think i'm facing another ...

  1. #1
    adrive
    Guest

    Unhappy help with file again :P

    hello again

    thanks for helping me out in all stuffs everyone : ) but now i think i'm facing another problem with my program....

    how can we actually check, if a file has nothing at all (Blank), then the program would prompt the user theres no such record.

    i tried:

    for(i=0;i<1000;i++)
    {
    if(add[i].staff_id=='\0')
    cout<<"No such record(s)"<<endl;
    }

    looks logical right?

  2. #2
    adrive
    Guest

    Arrow

    wowww thanks

    uhhhh.....i'm sorry but i can't understand pointer and link lists :P
    is there a much simpler code?

  3. #3
    adrive
    Guest
    thanks again..

    if( ( fd = fopen( file, "r" ) ) )
    {
    while( fgetc( fd ) != EOF )
    ++i;
    }

    else return 1;

    ( i == 0 ) ? puts( "file is void") : printf( "file is %d bytes big", i );
    return 0;
    }

    hmmm...whats fgetc ?? and then, is "(i == 0)?" same as "if(i==0)" ??

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. sequential file program
    By needhelpbad in forum C Programming
    Replies: 80
    Last Post: 06-08-2008, 01:04 PM
  2. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 09:54 AM
  3. Making a LIB file from a DEF file for a DLL
    By JMPACS in forum C++ Programming
    Replies: 0
    Last Post: 08-02-2003, 08:19 PM
  4. Hmm....help me take a look at this: File Encryptor
    By heljy in forum C Programming
    Replies: 3
    Last Post: 03-23-2002, 09:57 AM
  5. Need a suggestion on a school project..
    By Screwz Luse in forum C Programming
    Replies: 5
    Last Post: 11-27-2001, 01:58 AM

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