X-Git-Url: https://plomlompom.com/repos/?p=plomrogue;a=blobdiff_plain;f=server%2Futils.py;h=43ca9f28660d7a1963d720a40a475e51bdd4c32f;hp=22acb0dec6564eda7729be8b918e2e85ee9232a6;hb=72f01c15fb5297de8237a333adcce904ac1e3903;hpb=2235b640094c90718ec5d4984a57925a5e30e193 diff --git a/server/utils.py b/server/utils.py index 22acb0d..43ca9f2 100644 --- a/server/utils.py +++ b/server/utils.py @@ -84,8 +84,14 @@ def prep_library(): def c_pointer_to_bytearray(ba): """Return C char * pointer to ba.""" - type = ctypes.c_char * len(ba) - return type.from_buffer(ba) + ty = ctypes.c_char * len(ba) + return ty.from_buffer(ba) + + +def c_pointer_to_string(string): + """Return C char * pointer to string.""" + p = ctypes.c_char_p(string.encode("ascii")) + return p def parse_command_line_arguments():