Program of file data, C/C++ Programming

Program of file data:

FileData::FileData( ffblk& blk ) :

    fileName( blk.ff_name ),

    fileDate( (blk.ff_fdate >> 5) & 0x000F,

              blk.ff_fdate & 0x0001F,

              (blk.ff_fdate >> 9) + 1980 ),

    fileSize( blk.ff_fsize ),

    fileTime( blk.ff_ftime >> 11,

              (blk.ff_ftime >> 5) & 0x3F,

              blk.ff_ftime & 0x1F )

{

}

 

void FileData::printOn( ostream& outputStream ) const

{

    outputStream << setw( 14 ) << setiosflags( ios::left )   << fileName

                 << setw( 18 ) << fileDate

                 << setw( 17 ) << resetiosflags( ios::left ) << fileTime

                 << setw( 10 ) << fileSize << " bytes";

}

 

int FilesByName::isEqual( const Object& testFile ) const

{

    return fileName == ( (FilesByName&)testFile ).fileName;

}

 

int FilesByName::isLessThan( const Object& testFile ) const

{

    return fileName < ( (FilesByName&)testFile ).fileName;

}

 

int FilesByDate::isEqual( const Object& testFile ) const

{

    return fileDate == ( (FilesByDate&)testFile ).fileDate &&

           fileTime == ( (FilesByDate&)testFile ).fileTime;

}

 

int FilesByDate::isLessThan( const Object& testFile ) const

{

    if( fileDate == ( (FilesByDate&)testFile ).fileDate )

        return fileTime < ( (FilesByDate&)testFile ).fileTime;

    else

        return fileDate < ( (FilesByDate&)testFile ).fileDate;

}

 

int FilesBySize::isEqual( const Object& testFile ) const

{

    return fileSize == ( (FilesBySize&)testFile ).fileSize;

}

 

int FilesBySize::isLessThan( const Object& testFile ) const

{

    return fileSize < ( (FilesBySize&)testFile ).fileSize;

}

Posted Date: 10/18/2012 7:47:59 AM | Location : United States







Related Discussions:- Program of file data, Assignment Help, Ask Question on Program of file data, Get Answer, Expert's Help, Program of file data Discussions

Write discussion on Program of file data
Your posts are moderated
Related Questions
how yo use the friend function?

Scope Resolution operator: The scope resolution operator: : is used to access global variable in the inner block. When global and local variable are identical name the scope re

B a s i c D a t a t y p e : T h e r e a r e t h r e e t y p e o f d a t a t y p e i n C+ + 1.       P r

Example for external storage class - computer programming? extern double sin (double); In a function prototype, for the sin() function its function definition ~ we can write


Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b

print this pattern 1 01 101 0101

Classify computer system according to capacity. How they are different from computers according to the classification of technology. Provide comparative study also.

Virtual Base Classes This ambiguity can be resolved if the class derived have only one copy of the class base. This can be done by making the base class a virtual class. This k

A string S is said to be "Super ASCII", if it contains the character frequency equal to their ascii values. String will contain only lower case alphabets (''a''-''z'') and the asci