Why is fwrite writing more than I tell it to?

前端 未结 4 713
无人及你
无人及你 2020-12-18 21:21
FILE *out=fopen64(\"text.txt\",\"w+\");
unsigned int write;
char *outbuf=new char[write];
//fill outbuf
printf(\"%i\\n\",ftello64(out));
fwrite(outbuf,sizeof(char),w         


        
4条回答
  •  庸人自扰
    2020-12-18 21:52

    The variable write is uninitialized and so the size of the array and the amount written will be essentially random.

提交回复
热议问题