ok nice one, made a fair bit of progress thanks to you but this is a bit shocking. The below code gives 0 errors, but 121 warnings LOL. and also, it prints Mark twice (in the exe window) where it should print Mark, and then Harry, as I changed the data from mark to harry

Code:
// hhh.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

#include <map>
#include <string>
using namespace std;

typedef std::map<std::string, std::string> MyMap;
MyMap TestMap;

int main() {

	std::string chan( "#Channel" ); //keytype
	std::string mark( "Mark" );     //datatype

	TestMap.insert( MyMap::value_type( chan, mark ) );
	MyMap::iterator it = TestMap.find( chan );
	//this should print Mark
	if ( it != TestMap.end( ) ) {
		printf( (*it).second.c_str( ) ); 
		printf("\n");
	}

	//change #channel value from Mark to Harry
	TestMap.clear;
	std::string harry( "Harry" );
	TestMap.insert( MyMap::value_type( chan, harry ) );

	//this should now print Harry
	if ( it != TestMap.end( ) ) {
		printf( (*it).second.c_str( ) );
		printf("\n");
	}

	return 0;
}


Last edited by pouncer; 21/01/06 05:20 PM.