Printing all the permutations of a string in alphabetical order-ver1.1 I adapted most of the suggestions from answers for my previous question Printing all the permutations of a string in alphabetical order to rewrote my solution again. Please let me know any more changes required or any more suggestions.

#include &lt;iostream&gt;
#include&lt;fstream&gt;
#include&lt;algorithm&gt;
#include&lt;string&gt;

void create_permute(  std::string&amp; record )
{
    std::sort( record.begin(), record.end() );
    std::cout&lt;&lt;record;

    while( std::next_permutation( record.begin(), record.end() ) )
    {           
        std::cout&lt;&lt;","&lt;&lt;record;     
    } 
    std::cout &lt;&lt; "\n";    
}
void readInputFile( std::string filename ) 
{    
    std::ifstream infile(filename);
    std::string record;
    while( std::getline( infile,record ) )
    {        
       create_permute( record );
    }
    infile.close();
}

int main( int argc, char* argv[] )
{
    if( argc &lt; 2 )
    {
        std::cout &lt;&lt; "usage: filesize filename" &lt;&lt; "\n";
        exit( 0 );
    }
    std::ios_base::sync_with_stdio( false );
    readInputFile( argv[ 1 ] );   

    return 0;
}
Nothing I would bother about complaing about in real code review.

But for argument's sake:

Pass by const ref

Rather than passing by value. It usually means that an extra copy will be removed. In this case that's not true but I think its a good habit.

void readInputFile( std::string const&amp; filename ) 


No need to return 0 from main

If main() can not return anything else. Then I don't bother with a return statement in main (it's special). The compiler adds a return 0 if no return is provided for main.

Personally I use this (that face that I have not added a return) to indicate that the application has no real failure state.