Quantcast
Channel: Questions in topic: "log"
Viewing all articles
Browse latest Browse all 235

read the binary log file

$
0
0
Hi there! I'm trying to save the profiler inside a file, so I got a binary file, and when I tryed to read this file using Notpad++, VCS, Hexa Editor and also using script to convert to an ASCII encoding, i got this filewherein we can read some informations (red rectangles), but why we can not read the rest of the file (green rectangles) ![alt text][1]. here is the code used: using System; using System.IO; using System.Text; class Program { static void Main(string[] args) { // Read the file into var fs = new FileStream("mypath/mylog.log.data", FileMode.Open); var len = (int)fs.Length; var bits = new byte[len]; fs.Read(bits, 0, len); // Dump 16 bytes per line for (int ix = 0; ix < len; ix += 16) { var cnt = Math.Min(16, len - ix); var line = new byte[cnt]; Array.Copy(bits, ix, line, 0, cnt); // Write address + hex + ascii Console.Write("{0:X6} ", ix); Console.Write(BitConverter.ToString(line)); Console.Write(" "); // Convert non-ascii characters to . for (int jx = 0; jx < cnt; ++jx) if (line[jx] < 0x20 || line[jx] > 0x7f) line[jx] = (byte)'.'; Console.WriteLine(Encoding.ASCII.GetString(line)); } Console.ReadLine(); } } Thank you inadvance!!!! [1]: /storage/temp/47923-sans-titre.png

Viewing all articles
Browse latest Browse all 235

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>