[OT]
Most MMO's use UDP :)  And yes I am still writing an online book about it.
I've been working on getting my code tightened down as much as
possible, progress is slow and steady, but at least it's progress.  I
think I'll add the UDP based bittorrent replacement to the book.  If
nothing else it would make a good distribution medium for updates.
[/OT]

Anyways back to the subject, I whipped up a little program that should
do the trick.
Compile it and see if the results are a little better.  I can't vouch
that it does anything other than compile correctly, but it looks
mostly correct.

#include <iostream>
#include <fstream>

int main(int argc, char* argv[]){
        if(argc > 2){
                std::string filename = argv[1];
                int skiplines = atoi(argv[2]);
                std::string action = "mv temp.out ";
                std::ifstream infile (filename.c_str());
                std::ofstream outfile ("temp.out");
                std::string line;
                int x = 1;
                if(infile.is_open() && outfile.is_open()){
                        while(!infile.eof()){
                                getline(infile,line);
                                if(x < skiplines){ outfile << line;}else{ x++;}
                        }
                        infile.close();
                        outfile.close();
                        action += filename;
                        system(action.c_str());
                }       
        }else{
                std::cout << "frontcate is a program intended to truncate a 
given
number of lines from the front of a file" << std::endl;
                std::cout << "Usage: truncate FILENAME LINES" << std::endl;
        }
        
}


On 10/25/07, Levi Pearson <[EMAIL PROTECTED]> wrote:
> Shane Hathaway <[EMAIL PROTECTED]> writes:
>
> > Steve wrote:
> >> What about using nice and running it at a higher priority?
> >
> [... snip ...]
> > [OT] Hey, I thought you were busy writing a new peer-to-peer UDP
> > protocol. :-)
>
> I thought he was busy writing an online book about how to program a
> MMO game using UDP. :P
>
> I guess he's nice'd those processes, though. ;)
>
>                 --Levi
>
> /*
> PLUG: http://plug.org, #utah on irc.freenode.net
> Unsubscribe: http://plug.org/mailman/options/plug
> Don't fear the penguin.
> */
>

/*
PLUG: http://plug.org, #utah on irc.freenode.net
Unsubscribe: http://plug.org/mailman/options/plug
Don't fear the penguin.
*/

Reply via email to