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

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;

}

Posted Date: 10/19/2012 3:09:14 AM | Location : United States







Related Discussions:- Sorted directory - c++ program, Assignment Help, Ask Question on Sorted directory - c++ program, Get Answer, Expert's Help, Sorted directory - c++ program Discussions

Write discussion on Sorted directory - c++ program
Your posts are moderated
Related Questions
1. Create text a file with the name "myemail" that has a single line in it, consisting of your email address. Something like "firstname_lastname@carleton.ca" (or your hotmail or gm

recsection method source code for searching position


write a c progrm to find area under the cuve y=f(x)   #include float start_point, /* GLOBAL VARIABLES */ end_point, total_area; in

#questio c++ program for drawing thick line

c++ program to to implement multiple stacks using single array

What I need is an auto-click bot. The auto-click bot would ask me for a url(or it would be pre-defined too) so that it loads that specific url and click an ad automatically. This w

write a c++ program to find the prime numbers


What is Structure? An Array is a data structure whose elements are all of the similar data type. The structure is a data structure whose individual elements are able to differ