8000 print out buffer content in hexadecimal number format · mikephp/basic_data_struct@dad8f54 · GitHub
[go: up one dir, main page]

Skip to content

Commit dad8f54

Browse files
committed
print out buffer content in hexadecimal number format
1 parent a8e3d87 commit dad8f54

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/python/printc.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
buf=[0x1122,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]
2+
len = len(buf)
3+
print "len = %d"%(len)
4+
def printc(comment,buf,len):
5+
print "%s"%(comment)
6+
for i in range(len):
7+
print "%02x"%(buf[i]&0xff),
8+
if(0==(i+1)%8):
9+
print " #%d\r"%(i/8+1)
10+
printc("test",buf,len)
11+

0 commit comments

Comments
 (0)
0