I don’t program in Python at all, so please forgive my code. I am trying to write a print function that terminates after a certain number of bytes. This is what I have done so far:
def print_stuff(stuff, size):
i = 0
data = ""
while i < size:
if stuff[i]=='\0':
data += " "
else:
data += stuff[i]
print data
But when I tried to do printf_stuff(data, 5050) Python doesn’t print anything and seems to freeze. What am I doing wrong?
You’re not incrementing the value in
i.