Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First char is zeroed when passing string as char * #9

Open
mcpiroman opened this issue Dec 19, 2020 · 0 comments
Open

First char is zeroed when passing string as char * #9

mcpiroman opened this issue Dec 19, 2020 · 0 comments

Comments

@mcpiroman
Copy link

mcpiroman commented Dec 19, 2020

#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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant