Regarding file input/output...
Small project I am working on will require me to take a bunch of xxxx files, strip out various infos and create small subheaders with pointers to the data section...I know the complete format I need for the subheaders as well as all the offsets I need. However depending on the group of files the number of subheaders will var (the number is stored is the root outputs header).. Anyway, is it possible with pyhton to lets say, prompt the user for number of files and then... ummm better to kinda show I guess..
Lets say # of files is 20
I want to create a new file with my header it will include a text line, then subheaders from each of the 20 files with offset pointers to the start of data for that subheader
example below
Offset(h) 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
00000000 4D 55 4C 54 49 54 45 58 06 00 02 00 02 00 00 00 MULTITEX........
00000010 00 00 00 00 01 00 00 00 A4 00 00 00 18 00 00 00 ........¤.......
00000020 00 00 00 00 00 00 00 00 FF FF FF FF FF FF FF FF ........ÿÿÿÿÿÿÿÿ
00000030 FF FF FF FF 8A 79 47 3C 01 00 00 00 63 6F 72 64 ÿÿÿÿŠyG<....cord
00000040 5F 62 6F 64 79 00 00 00 00 00 00 00 00 00 00 00 _body...........
00000050 00 00 00 00 00 00 00 00 00 00 00 00 63 6F 72 64 ............cord
00000060 5F 62 6F 64 79 00 00 00 00 00 00 00 00 00 00 00 _body...........
00000070 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 ................
00000080 00 01 00 00 00 00 00 00 20 00 00 00 08 08 08 08 ........ .......
00000090 05 00 00 00 FF FF FF FF 01 00 00 00 A4 00 00 00 ....ÿÿÿÿ....¤...
000000A0 36 AC 00 00 6¬..
in the above 0x24-0xa3 is a sub header(0x80 byes) 9c-9f is the data offset (obviously one subheader 000a4 becomes the offset) a0-a4 is the data size 00-34 is he MAIN header...17-1a is the data start off set calculated by # of files multiplied by 0x80 Plus the main header size(0x24) (needed before hand to know where to place the first data section in the file...
so as I was asking, I need to create this, reading one file at a time, into ONE single output file, I can figure out pretty much most of it, but am unfamiliar with python and the commands dealing with input/output and appending data through those commands
doesn't have to be spelled out, just some general examples /help/suggestions...it's basically taking xxx number of files, changing their format and storing together in a different format
I know I am long winded and probably confusing...lol
Small project I am working on will require me to take a bunch of xxxx files, strip out various infos and create small subheaders with pointers to the data section...I know the complete format I need for the subheaders as well as all the offsets I need. However depending on the group of files the number of subheaders will var (the number is stored is the root outputs header).. Anyway, is it possible with pyhton to lets say, prompt the user for number of files and then... ummm better to kinda show I guess..
Lets say # of files is 20
I want to create a new file with my header it will include a text line, then subheaders from each of the 20 files with offset pointers to the start of data for that subheader
example below
Offset(h) 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
00000000 4D 55 4C 54 49 54 45 58 06 00 02 00 02 00 00 00 MULTITEX........
00000010 00 00 00 00 01 00 00 00 A4 00 00 00 18 00 00 00 ........¤.......
00000020 00 00 00 00 00 00 00 00 FF FF FF FF FF FF FF FF ........ÿÿÿÿÿÿÿÿ
00000030 FF FF FF FF 8A 79 47 3C 01 00 00 00 63 6F 72 64 ÿÿÿÿŠyG<....cord
00000040 5F 62 6F 64 79 00 00 00 00 00 00 00 00 00 00 00 _body...........
00000050 00 00 00 00 00 00 00 00 00 00 00 00 63 6F 72 64 ............cord
00000060 5F 62 6F 64 79 00 00 00 00 00 00 00 00 00 00 00 _body...........
00000070 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 ................
00000080 00 01 00 00 00 00 00 00 20 00 00 00 08 08 08 08 ........ .......
00000090 05 00 00 00 FF FF FF FF 01 00 00 00 A4 00 00 00 ....ÿÿÿÿ....¤...
000000A0 36 AC 00 00 6¬..
in the above 0x24-0xa3 is a sub header(0x80 byes) 9c-9f is the data offset (obviously one subheader 000a4 becomes the offset) a0-a4 is the data size 00-34 is he MAIN header...17-1a is the data start off set calculated by # of files multiplied by 0x80 Plus the main header size(0x24) (needed before hand to know where to place the first data section in the file...
so as I was asking, I need to create this, reading one file at a time, into ONE single output file, I can figure out pretty much most of it, but am unfamiliar with python and the commands dealing with input/output and appending data through those commands
doesn't have to be spelled out, just some general examples /help/suggestions...it's basically taking xxx number of files, changing their format and storing together in a different format
I know I am long winded and probably confusing...lol