-1

Ive got a form project in c++ and I need to be able to display a string in a console. Here is my code (which doesnt work). Are there any better ways?

std::string neemac = GenMacAddr();
    //Copy
    String^ str2 = gcnew String(neemac.c_str());
    //Finish
    system("echo ------------------------------------ && echo Generated Mac: " + str2 + " && echo ------------------------------------ && pause");
Ted Lyngmo
  • 93,841
  • 5
  • 60
  • 108

1 Answers1

0

In order to display a string in the console you could use std::cout. Example:

#include <iostream>
#include <string>
int main()
{
  std::string myStr = "Hello";
  std::cout << myStr << std::endl;
}