Some minor difficulties

BlitzMax Forums/BlitzMax Programming/Some minor difficulties

Pineapple(Posted 2008) [#1]
I'm trying to add B+ like print capabilites to bmax using cin and cout in c++. However, I do not get the desired results. What am I doing wrong?


bmax code:
Strict


Import "Console.cpp"
Extern "C"
Function ConsolePrint:Int(text$z)
Function ConsoleWrite:Int(text$z)
Function ConsoleLine:Int()
Function ConsoleInput$z(text$z)
Function ConsoleInput2$z(text$z)
End Extern

ConsolePrint "This is a test."

Delay 2000;End



Console.cpp:
#include <string>
#include <iostream>

using namespace std;

string input="";

extern "C" {
     bool ConsolePrint (char *text)
     {
          cout << text << endl;
          return true;
     }

     bool ConsoleWrite (char *text)
     {
          cout << text;
          return true;
     }
     
     bool ConsoleLine ()
     {
          cout << endl;
          return true;
     }
     
       string ConsoleInput (char *text)
       {
              cout << endl;
              cin >> input;
              cout << endl;
              return input;
       }

       string ConsoleInput2 (char *text)
       {
              cin >> input;
              return input;
       }
}