hi, i try to load my shader file from assets using ndk, all work fine but final char array contain random sybols at end, and the compiler can’t copile it, there is my function :
const char* getShaderSource(const char* src)
{
AAsset* shaderAsset = AAssetManager_open(mgr,src, AASSET_MODE_UNKNOWN);
if (mgr == NULL) {
LOGE("mgr is null");
}
size_t length = AAsset_getLength(shaderAsset);
LOGI("Shader source size: %d
", length);
char* buffer = (char*) malloc(sizeof(char)*length);
AAsset_read(shaderAsset, buffer, length);
LOGI("buffer source : %s
", buffer);
AAsset_close(shaderAsset);
return (buffer);
}
can you help me please.