Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

FileHandleCommandProcessor.cpp

Go to the documentation of this file.
00001 #ifdef TEST
00002 
00003 #include "headers.h"
00004 
00005 
00006 FileHandleCommandProcessor::FileHandleCommandProcessor() {
00007     m_input = stdin;
00008     m_output = stdout;
00009     m_prompt = PROMPT;
00010 } // ctor
00011 
00012 
00013 void
00014 FileHandleCommandProcessor::init() {
00015     fprintf(m_output, "Peekabooty  (Version %s)\n", PEEK_A_BOOTY_VERSION);
00016 }
00017 
00018 
00019 void
00020 FileHandleCommandProcessor::readCommand(string* input) {
00021     fprintf(m_output, "\n");
00022     fprintf(m_output, m_prompt.c_str());
00023     fflush(m_output);
00024 
00025     const int bufsize = 4096;
00026     char buffer[bufsize];
00027     // Read the users command
00028     if (fgets(buffer, bufsize, m_input) == NULL) {
00029         *input = "";
00030         return;
00031     }
00032     
00033     *input = buffer;
00034 } // fn readCommand
00035 
00036 
00037 void 
00038 FileHandleCommandProcessor::displayResponse(string* output) {
00039     fprintf(m_output, output->c_str());
00040 } // fn displayResponse
00041 
00042 #endif
00043 

Generated at Thu Jul 11 13:31:50 2002 for Peekabooty by doxygen1.2.9 written by Dimitri van Heesch, © 1997-2001