What is the C Equivalent of Python's pack(“<I”, 0)

前端 未结 1 1369
日久生厌
日久生厌 2021-01-15 03:30

I don\'t know much python but from what I can tell from the documentation the code:

   str = \"AAAA\"
   str += pack(\"

would ap

1条回答
  •  春和景丽
    2021-01-15 04:04

    strcat() stops at the first NUL, so no.

    char str[20] = "AAAA";
    int val = 0;
    int nval = htole32(val);
    memcpy(str + 4, (char*)&nval, 4);
    

    0 讨论(0)
提交回复
热议问题