Sorted directory - c++ program, C/C++ Programming

Assignment Help:

Sorted directory - C++ program:

Write a program in c to sorting a directory.

int main( int argc, char *argv[] )

{

    if( argc < 2 || argc > 3 )

        {

        cerr << "Usage:  directry [options] filespec" << endl << endl;

        cerr << "Options:" << endl;

        cerr << "\t-sd\tsort by date" << endl;

        cerr << "\t-sn\tsort by name" << endl;

        cerr << "\t-ss\tsort by size" << endl;

        exit(1);

        }

 

    int path;                      

    Directory::sortOrder sorting = Directory::byName;

 

    if( argc != 3 )

        path = 1;

    else

        {

        path = 2;

        if( strcmp( argv[1], "-sn" ) == 0 )

            sorting = Directory::byName;

        else if( strcmp( argv[1], "-sd" ) == 0 )

            sorting = Directory::byDate;

        else if( strcmp( argv[1], "-ss" ) == 0 )

            sorting = Directory::bySize;

        }

 

    Directory sortedDirectory( argv[path], sorting );

    cout << sortedDirectory;

    return 0;

}


Related Discussions:- Sorted directory - c++ program

Recursion, #questiowrite a program to calculate e^x

#questiowrite a program to calculate e^x

Palindrome, string S convert it to a palindrome by doing chara, C/C++ Progr...

string S convert it to a palindrome by doing chara, C/C++ Programming

Project (network programming), Need help in network programming in C++ proj...

Need help in network programming in C++ project. How much you charge?

#AREA UNDER CURVE, #question.Write a program to find the area under the cur...

#question.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. The area under a curve between two po

Program to compute distance travelled by ball, Produce a pseudo code to be ...

Produce a pseudo code to be used for development compute and display some data on the bounces a ball will make when dropped from a given height. To simplify the problem, you ass

Online poker web application, Project Description:  LOOKING TO DEVELOP ...

Project Description:  LOOKING TO DEVELOP A ONLINE POKER Web Application. WEBSITE WILL BE DEVELOPED OVER THE NEXT 6 MONTHS Duration & WILL REQUIRE FULL SOFTWARE CODING OF WEB

Cin, how we use the cin command and why we use this command????

how we use the cin command and why we use this command????

Luminous Jewels - The Polishing Game, Byteland county is very famous for lu...

Byteland county is very famous for luminous jewels. Luminous jewels are used in making beautiful necklaces. A necklace consists of various luminous jewels of particular colour. Nec

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd