Forum > Beginners

Question about parsing with non printable char

(1/6) > >>

nugax:
I am trying to write a program that dumps data out from a specific structured message file. The file has a 1) Packet header 2) Msg header. The packet header I can seem to pull, but I can seem to get the message header to load or parse.

Each of the fields To: From: Subject: etc are seperate by byte 00 - but iwth all my code trying the from and other sections do not line up. Can any shed some light? I provided an example of my records(as the structure says it should be) and also a packet file to look at.

Note, each field is NOT exactly the size of the structure in the record. It is as long as it is + a 00. If you look at it in a hexdump you can see the 00 after each set. I dont know why this is so complicated. I am probably over complicating it.

Some packets can contain more than 1 message, therefore multiple message headers which this field is. The message should start with a 13 0 2 0   inside each packet.



--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} --- PktMessage = record { Packet Header of each individual message }     OrigNode,    DestNode,    OrigNet,    DestNet,    Attr,    Cost: word;    Date: string[20];    Too: string[36];    From: string[36];    Subject: string[72];    AreaName: string[20];  end;           

Bart:
Does the application in question actually use pascal style strings liek you declared in your record?

Bart

nugax:
According to the spec docs that is the correct structures and sizes.
But this is old, really old stuff. And there isnt a lot of info, and people do it different ways.

So its hard to say that it is 100% correct, but it should be.

But, I still should be able to manually parse and write to each variable, I just cant get that working. It dectects the spaces between the fields with 00, i checked, but when I do a repeat or while loop ending on 00 of a byte, it doesnt work.

Here is an example:


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---  repeat   // write(msgheader.AreaName[i] + '-');    Inc(i);  until(byte(Msgheader.AreaName[i]) = 00)                                               

that wont work properly. It reads past the 00. I cant figure out how to parse it.

nugax:
ive done it other ways too... they all fail to stop at 00. Im sure im not using FP right to see the non printable 00... so i thought you guys may have an idea.

nugax:
You can put this code in, and run it on the file, and it will print out eahc 00, which is why I dont understand why its not finding them for the records variables im trying to populate (to, from, date, subject, orgnod, orgnet, etc...



--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---repeat     read(f, byinput);     ch := chr(byinput);     write(ch);     if (byinput = 00) then       write('00');    chinputprompt:=crt.ReadKey;  until (chinputprompt = 'q');                                 

Navigation

[0] Message Index

[#] Next page

Go to full version