well looks like there have been 4 different methods posted...
Perl, PHP, grep, and VB...
now go at it!
Printable View
well looks like there have been 4 different methods posted...
Perl, PHP, grep, and VB...
now go at it!
hmmm, interesting that 4 non-C/C++ solutions were posted at the c-board. :eek:Quote:
Originally Posted by DavidP
Solves that problem...Code:#include <iostream>
#include <fstream>
#include <vector>
#include <string>
int main ( void )
{
std::ifstream load ( "sourcefile.cpp" );
std::vector < std::string > lines;
std::string tempStr;
while ( !load.eof() )
{
getline(load, tempStr);
lines.push_back(tempStr);
}
load.close();
std::ofstream save ( "sourcefile.cpp" );
for ( int k = 0; k < lines.size(); k++ )
{
save << (k + 1) << "\t" <<
lines[k] << "\n";
}
save.close();
return 0;
}
Hmm.. does that tell you anything about the worthiness of C/C++? ;)Quote:
Originally Posted by Perspective
It's so pure that to be spoken in this thread would dishonor it - and the speaker?Quote:
Originally Posted by ober
> Hmm.. does that tell you anything about the worthiness of C/C++?
It tells you that many people have a lot more tools in the toolbox than some one-dimensional being who swears 'x' is best for everything.
Salem is kickin'
(according to his reputation bars)
....
Meanwhile Prelude exudes kindness and good coding practice while Thantos apparently refers to himself as being special.
Just for the record I never rode ANY school buses!
RIGHT. Just short buses, huh? ;)
>Just for the record I never rode ANY school buses!
You poor soul. I'm sorry you missed out on the adventure.