Go Back   Forums > Community Chatterbox > Tech Corner > Programming
Memberlist Forum Rules Today's Posts
Search Forums:
Click here to use Advanced Search

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 10-10-2008, 06:37 AM   #23
Data
retired
 
Data's Avatar


 
Join Date: Jun 2004
Location: Jan Mayen, Svalbard and Jan Mayen
Posts: 2,167
Default

the only thing I can think of is the line ends being different. I did convert them to unix line ends. It shouldn't matter as I compiled the executable for windows, but maybe that doesn't convert the line ends internally afteral, or maybe it needed a switch.

I used C++ to program it, it is a quick getting the job done piece of code.

Let me post it here. Don't bother with pointing out all C-isms and other things which I could have done better. I know them myself as well.
Code:
/* Copyright Data */

#include <string>
#include <iostream>

int main (int argc, char *argv[]) {
        std::string templine;
        std::string index, timeindex, text;
        std::string index2, timeindex2, text2;

        //Get initial record:
        getline (std::cin, index);
        getline (std::cin, timeindex);
        templine = "";
        do {
                getline (std::cin, templine);
                text += templine;
                text += "\n";
        }
        while (templine != "");

        while (std::cin) {
                getline (std::cin, index2);
                getline (std::cin, timeindex2);
                templine = "";
                do {
                        getline (std::cin, templine);
                        text2 += templine;
                        text2 += "\n";
                }
                while (templine != "");

                //writeout record:
                std::cout << index << std::endl;
                std::cout << timeindex << std::endl;
                std::cout << text2;

                //move up:
                index = index2;
                timeindex = timeindex2;
                text2 = "";
        }
        return 0;
}
__________________
Flowing with the stream of life

Last edited by Data; 10-10-2008 at 06:39 AM.
Data is offline                         Send a private message to Data
Reply With Quote
 


Similar Threads
Thread Thread Starter Forum Replies Last Post
Castlevania movie script revealed TheChosen Blah, blah, blah... 16 18-07-2008 06:41 PM
Abandonia Script? jourdan Old Suggestions 4 09-07-2007 09:24 AM
Script Not Working After Migrate Reup Old Suggestions 1 25-08-2006 11:58 AM
Annoying Script Prompt -RESOLVED guesst Old Suggestions 7 28-07-2006 01:00 AM


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump
 


The current time is 12:40 PM (GMT)

 
Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.