text: I am using visual C++ 6.0 to write a DLX architecture simulation for my class. I have a sample input file that contains the instructions I will be simulating. For some reason I am unable to use cout to print the contents of a string. Its been awhile since I have programmed so maybe I am overlooking something simple. Here is my code:
  #include <stdio.h>
  #include <iostream.h>
  #include <fstream.h>
  #include <string>
  #include <cstdlib>
  main() {
  char line[20];
  char *ptr;
  std::string test;
  ifstream assemblyfile;
  assemblyfile.open("Z:\\School\\EE552\\input.txt", ios::in);
  assemblyfile.getline(line,20,'\n');
  ptr = strtok(line,",");
  while(ptr != NULL) {
  test = ptr;
  cout << test << endl; //This is the line that causes the error
  ptr = strtok(NULL,",");
  }
  assemblyfile.close();
  return(0);
  }
  The error message I get is:
  error C2679: binary '<<' : no operator defined which takes a right-hand operand of type 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >' (or there is
  no acceptable conversion)
  I can also not use the "using namespace std" without getting an error.
  Thanks in advance for the help.