All pastes #829841 Raw Edit

Untitled

public cpp v1 · immutable
#829841 ·published 2007-12-23 14:49 UTC
rendered paste body
void translateStream(istream &input,ostream &output){        static int mpe=0;        if(mpe==15)                return;        if( !(input.good()) )                return;        char tempWords[64];        char tempTranslated[100];        char tempChar = '\0';        memset(tempWords, '\0', 64);        memset(tempTranslated, '\0', 100);        bool notInWord = true;        bool completeWord = false;        bool eofFound = false;        int i = 0;        while( !(completeWord) )        {                input.get(tempChar);                if( (isspace(tempChar) || ispunct(tempChar)) && notInWord )                {                        output << tempChar;                }                else if((isspace(tempChar)||ispunct(tempChar))&& !(notInWord))                {                        input.unget();                        completeWord = true;                }                else                {                        notInWord = false;                        tempWords[i]=tempChar;                        i++;                }        }