JL35
Nombre de messages : 7112 Localisation : 77 Date d'inscription : 29/11/2007
| Sujet: Un bug dans FILEBIN_HEXA_WRITE ? Dim 2 Mai 2010 - 14:31 | |
| Un petit programme de conversion d'un fichier binaire (image) en lignes de datas, et inversement, pour intégrer une petite image dans un exe, et qui exploite les nouvelles fonctions BIN/HEXA de Panoramic. (la série de datas a été constituée avec la première routine Fic2dat): - Code:
-
' Ficdat.bas conversion fichier binaire en lignes de datas et inversement ERROR_FRENCH DIM f$, fr$, fb$, a$, sz, nbl, lb, rst, i% LABEL Fic2dat, Dat2fic
f$ = "C:\Graph\BMP\Pnoel.bmp" fr$ = "Z:\Data.dat" fb$ = "Z:\image.bmp"
DATA "424DCE0800000000000036040000280000001B0000002A000000010008000000" DATA "0000980400000000000000000000000100000001000000000000080000000008" DATA "0000000008000008080008101000081021000000290039189C001800A5003908" DATA "CE009CD6D6003100EF00F7FFF700FFFFF700EFF7FF00F7F7FF00FFF7FF0008FF" DATA "FF0010FFFF0018FFFF0031FFFF0039FFFF006BFFFF00C6FFFF00DEFFFF00EFFF" DATA "FF00F7FFFF00FFFFFF00FFFFFF00000000000000000000000000000000000000" DATA "0000000000000000000000000000000000000000000000000000000000000000" DATA "0000000000000000000000000000000000000000000000000000000000000000" DATA "0000000000000000000000000000000000000000000000000000000000000000" DATA "0000000000000000000000000000000000000000000000000000000000000000" DATA "0000000000000000000000000000000000000000000000000000000000000000" DATA "0000000000000000000000000000000000000000000000000000000000000000" DATA "0000000000000000000000000000000000000000000000000000000000000000" DATA "0000000000000000000000000000000000000000000000000000000000000000" DATA "0000000000000000000000000000000000000000000000000000000000000000" DATA "0000000000000000000000000000000000000000000000000000000000000000" DATA "0000000000000000000000000000000000000000000000000000000000000000" DATA "0000000000000000000000000000000000000000000000000000000000000000" DATA "0000000000000000000000000000000000000000000000000000000000000000" DATA "0000000000000000000000000000000000000000000000000000000000000000" DATA "0000000000000000000000000000000000000000000000000000000000000000" DATA "0000000000000000000000000000000000000000000000000000000000000000" DATA "0000000000000000000000000000000000000000000000000000000000000000" DATA "0000000000000000000000000000000000000000000000000000000000000000" DATA "0000000000000000000000000000000000000000000000000000000000000000" DATA "0000000000000000000000000000000000000000000000000000000000000000" DATA "0000000000000000000000000000000000000000000000000000000000000000" DATA "0000000000000000000000000000000000000000000000000000000000000000" DATA "0000000000000000000000000000000000000000000000000000000000000000" DATA "0000000000000000000000000000000000000000000000000000000000000000" DATA "0000000000000000000000000000000000000000000000000000000000000000" DATA "0000000000000000000000000000000000000000000000000000000000000000" DATA "0000000000000000000000000000000000000000000000000000000000000000" DATA "000000000000000000000000000000000000000000001D1D1D1D1D1D1D1D1D1D" DATA "1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D001D1D1D1D1D1D1D1D000000001D1D" DATA "1D000000001D1D1D1D1D1D1D1D001D1D1D1D1D1D1D001C1C1C1C001D001C1C1C" DATA "1C001D1D1D1D1D1D1D001D1D1D1D1D1D1D001C1C1C1C001D001C1C1C1C001D1D" DATA "1D1D1D1D1D001D1D1D1D1D1D1D1D001C1C1C001D001C1C1C001D1D1D1D1D1D1D" DATA "1D001D1D1D1D1D1D1D1D1D0000001D1D1D0000001D1D1D1D1D1D1D1D1D001D1D" DATA "1D1D1D1D1D1D1D1D00001D1D1D00001D1D1D1D1D1D1D1D1D1D001D1D1D1D1D1D" DATA "1D1D1D1D00001D1D1D00001D1D1D1D1D1D1D1D1D1D001D1D1D1D1D1D1D1D1D1D" DATA "000000000000001D1D1D1D1D1D1D1D1D1D001D1D1D1D1D1D1D1D1D0005001C1B" DATA "1B0505001D1D1D1D1D1D1D1D1D001D1D1D1D1D1D1D0000001A1B101C1C0F1B00" DATA "00001D1D1D1D1D1D1D001D1D1D1D1D1D1D00191B0F1B1C1C1C1C1B1A1A001D1D" DATA "1D1D1D1D1D001D1D1D1D1D1D1D001C1C1C0E1C1C1C1B1A1A0D001D1D1D1D1D1D" DATA "1D001D1D1D1D001D1D000E1C0E0E1C0E1B101B1B1B001D1D001D1D1D1D001D1D" DATA "1D001C001D001A1A0D1C0E1C1A1C10101C001D001C011D1D1D001D1D001C001D" DATA "1D001819191A0005021A1B101B001D1D001C011D1D001D1D001C001D1D051818" DATA "181818181818181818051D1D0010011D1D001D1D001C1C000017060606060606" DATA "06060606060B0503101C011D1D001D1D001C1C00001714141414141616141414" DATA "161705031C10021D1D001D1D1D00000003161212141314141314141214160503" DATA "03021D1D1D001D1D1D1D000003161414141414131416161414160503001D1D1D" DATA "1D001D1D1D1D1D1D0317141605051614140505141417051D1D1D1D1D1D001D1D" DATA "1D1D1D1D1D051716050514141405051416031D1D1D1D1D1D1D001D1D1D1D1D1D" DATA "0505171717141714161717161705031D1D1D1D1D1D001D1D1D1D1D02190F0303" DATA "051414171714050305031C031D1D1D1D1D001D1D1D1D1D031B1C1C1005050505" DATA "0503051C1C1B1B051D1D1D1D1D001D1D1D1D0310100E0E0D1A1A0D19190F101C" DATA "0E0D0D0D001D1D1D1D001D1D1D1D1D05101B0D1A0D0E0E10101C101C0D0E0D02" DATA "1D1D1D1D1D001D1D1D1D1D00000305101010101B0E100D0D050503051D1D1D1D" DATA "1D001D1D1D1D1D1D1D1D03070606060607060701051D1D1D1D1D1D1D1D001D1D" DATA "1D1D1D1D1D1D07090A0A0A0A0A0A0908071D1D1D1D1D1D1D1D001D1D1D1D1D1D" DATA "1D1D070A0A0A0A0C0C0C0A08071D1D1D1D1D1D1D1D001D1D1D1D1D1D1D1D030A" DATA "0A0C0A0C0C0C0A08071D1D1D1D1D1D1D1D001D1D1D1D1D1D1D1D1D070A0A0C0C" DATA "0C0C0A071D1D1D1D1D1D1D1D1D001D1D1D1D1D1D1D1D1D1D070A0C0C0C0A061D" DATA "1D1D1D1D1D1D1D1D1D001D1D1D1D02001D1D1D1D070A0C0C0C0A071D1D1D1D1D" DATA "1D1D1D1D1D001D1D1D020E1C031D1D1D070A0A0C0A071D1D1D1D1D1D1D1D1D1D" DATA "1D001D1D1D050F1C1C03070708090A0A08071D1D1D1D1D1D1D1D1D1D1D001D1D" DATA "1D001C10031D03080A0A0A08071D1D1D1D1D1D1D1D1D1D1D1D001D1D1D1D0005" DATA "1D1D1D07080A08031D1D1D1D1D1D1D1D1D1D1D1D1D001D1D1D1D1D1D1D1D1D1D" DATA "0707071D1D1D1D1D1D1D1D1D1D1D1D1D1D001D1D1D1D1D1D1D1D1D1D1D1D1D1D" DATA "1D1D1D1D1D1D1D1D1D1D1D1D1D00" DATA "F": ' butée de fin
GOSUB Fic2dat: ' conversion du fichier image d'origine en ligne de datas
f$ = fb$: GOSUB Dat2fic PICTURE 1: FILE_LOAD 1, fb$
END
Fic2dat: ' Conversion de f$ en lignes de datas dans fr$ FILEBIN_OPEN_READ 1, f$: FILE_OPEN_WRITE 2, fr$ sz = FILEBIN_SIZE(1): lb = 32 nbl = INT(sz/lb): rst = lb*FRAC(sz/lb) FOR i% = 1 TO nbl FILEBIN_HEXA_READ 1, lb, a$ FILE_WRITELN 2, "DATA " + CHR$(34) + a$ + CHR$(34) NEXT i% IF rst > 0 FILEBIN_HEXA_READ 1, rst, a$ FILE_WRITELN 2, "DATA " + CHR$(34) + a$ + CHR$(34) END_IF FILEBIN_CLOSE 1: FILE_CLOSE 2 RETURN
Dat2fic: ' Conversion de lignes de datas en fichier f$ FILEBIN_OPEN_WRITE 1, f$ READ a$ REPEAT lb = INT(LEN(a$)/2) FILEBIN_HEXA_WRITE 1, lb, a$ READ a$ UNTIL a$ = "F" FILEBIN_CLOSE 1 RETURN mais je récupère sur la ligne - Code:
-
FILEBIN_HEXA_WRITE 1, lb, a$ (4 lignes avant la fin) l'erreur: N'y aurait-il pas une confusion avec le FILEBIN_BLOCK_WRITE qui lui attend un tableau ? | |
|