c++ - Save byte pointer to a file -


i'm using protonsdk (www.protonsdk.com)

im trying use function

byte *pdata = getfilemanager()->get("texturefile.rttex", &filesizebytes, true, true); 

i want save output file (decompressed rtpack) doesn't want to.

i new c++ have background php

you can write file c++ standard library.

http://www.cplusplus.com/doc/tutorial/files/

or c standard library.

write data pdata pointing to.

#include <stdio.h> #include <stdlib.h>  /* proton sdk header */ /* header byte type (not part of c standard library) */  int main(int argc, char** argv) {         int filesizebytes;         file* fp;          byte *pdata = getfilemanager()->get(getsavepath()+"test.txt", &filesizebytes, true);          fp = fopen("put_filename_here", "w");         if(fp == null) {                 fprintf("cannot open file!\n");                 exit(-1);         }         fwrite(pdata, filesizebytes, sizeof(byte), fp);         fclose(fp);         return 0; } 

write pdata file. fwrite(&pdata, 1, sizeof(pdata), fp);


Comments

Popular posts from this blog

python - Healpy: From Data to Healpix map -

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -