Bonjour a tous,

Voici mon problème : je souhaite afficher le contenu d'un fichier exe (comme si on ouvrait un exe avec notpad) mais pas en hexa. J'ai remarqué un problème lorsque la chaîne chr(0x00) devait être affiché cela arrête l'affichage. Je pense que c'est le char de fin de string.

Si quelqu’un à une idée.
L’idéale pour moi est d’afficher un carré comme pour le 0x01. (Mais je ne veux pas faire un "repalce")
Voici un petit bout de code pour montrer le pb:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env python
# _*_ coding: utf-8 _*_
import wx
 
class TextctrlExampleFrame(wx.Frame):
	def __init__(self, parent, title):
		wx.Frame.__init__(self, parent, title=title)
		panel = wx.Panel(self)
 
		textCtrl1 = wx.TextCtrl(panel)
		textCtrl2 = wx.TextCtrl(panel)
 
		Box = wx.BoxSizer(wx.VERTICAL)
		Box.Add(textCtrl1,1,wx.EXPAND)
		Box.Add(textCtrl2,1,wx.EXPAND)
		panel.SetSizer(Box)
 
		text1 = "test".join(chr(i) for i in [0x01,0x31,0x69,0x69])
		text2 = "test".join(chr(i) for i in [0x01,0x31,0x00,0x69])
		textCtrl1.AppendText(text1)
		textCtrl2.AppendText(text2)
		self.Show()
 
if __name__ == '__main__':
	import traceback
	try:
		app = wx.PySimpleApp(redirect=True)
		frm = TextctrlExampleFrame(None, "TextCtrl Example")
		app.MainLoop()
	except:
		traceback.print_exc (file=open('error.txt', 'w'))
Merci d'avance
Jean-Michel