genepi
genepi copied to clipboard
First char is zeroed when passing string as char *
#include <genepi/genepi.h>
void test1(char* str1) {
for(int i = 0; i < 5; i++) {
std::cout << (int)str1[i] << " ";
}
}
GENEPI_MODULE( lib );
GENEPI_FUNCTION( test1 );
const lib = require('./build/Release/lib.node')
lib.test1('test')
Prints:
0 101 115 116 0 (which is \0est\0 in ascii)
Platform:
Microsoft Windows NT 10.0.18363.0
Visual Studio 16 2019 generator
-- Selecting Windows SDK version 10.0.18362.0 to target Windows 10.0.18363.
-- The C compiler identification is MSVC 19.28.29335.0
-- The CXX compiler identification is MSVC 19.28.29335.0