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

How can I fix this to, Write a program consisting of two functions (plus ma...

Write a program consisting of two functions (plus main). The first function should read in a number and then pass this back to main. This value should then be passed into a secon

Minimization and karnaugh maps, There are formal ways of reducing Boolean e...

There are formal ways of reducing Boolean expressions in order to minimize the logic circuit. The two elementary ways of minimization are using Boolean expressions/De Morgan Theore

GPA Calculator, I am having trouble declaring a variable and returning a va...

I am having trouble declaring a variable and returning a value from my function.

Assigment, Hi is there any chance to get assignment for fresher tutor

Hi is there any chance to get assignment for fresher tutor

Diploma in IT, Function fact explain how the process of recursion works in ...

Function fact explain how the process of recursion works in C++.In your answer assume that the function is called to calculate the factorial of 6?

Write a program that illustrate Macros with Arguments, Write a program tha...

Write a program that illustrate  Macros with Arguments? Macros is able to also have arguments, just as functions can. #define AREA(x)(3.14*x*x) Then at any time the prepr

Bitcoin alternative – deployment and modification, I started preparing an a...

I started preparing an alternative cryptocurrency and I am way over my head. I would like help in making modifications to the open source files and then help with deployment. I wil

Project, Project Overview A certain financial institution (bank) wishes to ...

Project Overview A certain financial institution (bank) wishes to promote its new business products/services by conducting road shows in rural areas. Their aim is to encourage peop

Bus Connection, how to explain working of bus connection

how to explain working of bus connection

Minimum shelf, At a shop of marbles, packs of marbles are prepared. Packets...

At a shop of marbles, packs of marbles are prepared. Packets are named A, B, C, D, E …….. All packets are kept in a VERTICAL SHELF in random order. Any numbers

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