recording videos with different file names

Questions about Marilou Open Devices Access (MODA)
Post Reply
rykkers
Posts: 14
Joined: Thu Nov 12, 2009 2:28 pm

recording videos with different file names

Post by rykkers » Fri Nov 20, 2009 3:13 pm

hi guys, sorry to be a pain, i'm new to c++. i'm trying to record videos to filenames including an int:

Code: Select all

//If at a certain generation, then record the best individual
			if (iteration % 2 == 0) {
				std::stringstream myString;
				myString << "c:\\generation" << iteration << ".avi";
				std::string str = myString.str();
				pConnection->VideoRecordingStart(str,"DIB",false,640,480,15);
				fitness(populationCopy[0]);
				pConnection->VideoRecordingStop();
			}
however i'm having a problem that the compiler can't convert:
.\Main.cpp(212) : error C2664: 'ModaCPP::Connection::VideoRecordingStart' : cannot convert parameter 1 from 'std::string' to 'xkode::lib::String'
any ideas? i'm sure i'm just being dumb

thanks

Ryk

LR
Posts: 305
Joined: Mon Feb 12, 2007 11:55 pm
Location: FR

Post by LR » Fri Nov 20, 2009 4:20 pm

Hi,

Try something like:

xkode::lib::String myfilepath( myString.c_str());
pConnection->VideoRecordingStart(myfilepath,"DIB",false,640,480,15);

if you are using UNICODE (wide chars), try that:

xkode::lib::StringW myfilepath( myString.c_str());
pConnection->VideoRecordingStart(xkode::lib::String(myfilepath),"DIB",false,640,480,15);
LR

rykkers
Posts: 14
Joined: Thu Nov 12, 2009 2:28 pm

done and dusted

Post by rykkers » Fri Nov 20, 2009 5:10 pm

hi, close but no cigar, it just needed .str() added in the middle

Code: Select all

xkode::lib::String myfilepath( myString.str().c_str());
thanks very much for your help, hopefully I'm now finished with the coding stage of my project.

So again just in case someone else stumbles upon this trying to do the same, to increment file names:

Code: Select all

std::stringstream myString;
				myString << "c:\\generation" << iteration << ".avi";
				xkode::lib::String myfilepath( myString.str().c_str()); 
				pConnection->VideoRecordingStart(myfilepath,"DIB",false,640,480,15);
				fitness(populationCopy[0]);
				pConnection->VideoRecordingStop();
thanks again

Ryk

Post Reply