Assume p = ctypes.cast("foo", ctypes.POINTER(ctypes.c_char)).
Thus, we have p.contents.value == "f".
How can I directly access and manipulate (e.g. increment) the pointer? E.g. like (p + 1).contents.value == "o".
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You have to use indexing:
Have a look at ctypes documentation to find out more about using pointers.
UPDATE: It seems that it’s not what you need. Let’s, then, try another approach: first cast the pointer to void, increment it and then cast it back to LP_c_char:
Maybe it’s not elegant but it works.