///////////////////////////////////////////////////////////////////////// /// TestBridge.cpp - Test use of unmanaged code from managed code /// /// ver 2.0 /// /// /// /// Language: Visual C++, ver 7.0, Visual Studio.Net /// /// Platform: Dell Dimension 8100, Windows Pro 2000 /// /// Application: CSE681 Example /// /// Author: Jim Fawcett, CST 2-187, Syracuse Univ. /// /// (315) 443-3948, jfawcett@twcny.rr.com /// ///////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////// /// build process /// ///////////////////////////////////////////////////////////////////////// /// Required Files: /// /// TestBridge.cpp, BridgeToCPPengine.dll /// /// Compile Command: /// /// cl /MTd TestBridge.cpp BridgeToCPPengine.dll /// /// Run Command: /// /// TestBridge /// ///////////////////////////////////////////////////////////////////////// /* Maintenance History =================== ver 2.0 : 25 Jan 04 - major changes to accommodate simplifying redesign of Bridge class ver 1.0 : 13 Sep 02 - first release */ // #include "stdafx.h" #using #using "debug/bridgeToCPPengine.dll" #include #include #include #include #include "../bridgeToCPPengine/Tok.h" using namespace System; using namespace System::Text; using namespace bridgeToCPPengine; using namespace std; int _tmain(int argc, char* argv[]) { Console::WriteLine(S"\n Testing Bridge to Unmanaged C++\n"); if(argc < 2) { cout << "\n Please enter name of file to tokenize on command line\n\n"; return 1; } else { cout << "\n Processing file: " << argv[1] << "\n ================================================\n"; } String *file = new String(argv[1]); Bridge* br = new Bridge(); if(!br->attach(file)) { cout << "\n can't open file "; Console::Write(file); cout << "\n\n"; return 1; } String* Tok = new String(""); while(br->GetTok(Tok)) { // throw away newlines returned as tokens if(Tok->Chars[0] != '\n') Console::Write("\n {0}",Tok); } std::cout << "\n\n"; return 0; }