My node.js code does this :
var MyMQ = require( './build/release/mqconn' ) ;
var MyQmgrName = 'QM_CNT' ; // req.params.qmgrname ;
MyMQ.connect ( MyQmgrName, function ( err, result ) {
And my C++ code (uning nan) wants to receive the first string parameter :
NAN_METHOD( MQ_Connect ) {
NanScope();
Local<Value> szQMN( args[ 0 ] );
printf( "(cc)>>>> qmn [%s].\n", szQMN ) ;
... but what I get is garbage.
Any clue on what am I doing wrong ? Sebastian.
First you should generally validate your arguments. Then you can get a string by calling
ToString()
on the argument. For example: