I just started teaching myself some basic things with this, but the simplest shit like strings seems impossible. Does anyone know any good sources, tutorials, or anything that might help me more?

As an example...I wrote this code to tell when a control button was pressed:

//ProcessKeys
		int key;
		string s;
		s="";
		scanKeys();
		key = keysDown();
		if (key & KEY_DOWN){
			s="down";
		}
		if (key & KEY_UP){
			s="up";
		}
		if (key & KEY_LEFT){
			s="left";
		}
		if (key & KEY_RIGHT){
			s="right";
		}
		if (s!=""){
			iprintf(s);
		}

I get this error:

'string' was not declared in this scope

It doesn't know what string is?

Well, the first thing that comes to my mind, a PAlib project is still just basicly the heading of a header, it doesn't nullify your basic capabilities of the language, so, are you sure you remembered to #include "string.h" and using namespace std ?

edit: I got it working, but only worked with #include <string> instead of #include <string.h>

One more compiling issue though with the final iprintf(s); statement

cannot convert 'std::string' to 'const char*' for argument '1' to 'int iprintf(const char*, ...)'

Is there a simple

s.toChar()

or something that I could use?

s.c_str() should do the trick =)

Ah, yes, that fixed it. Thank you muchly

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.