25-08-2012, 11:12 PM
"كيف نجعل الحجم متغير للعدم الخسارة في الحجم لاننا عند القرائة سنحدد عدد البايتات المقروئة "
- تقريبا نفس الفكرة في تحويل الـ XM إلى *.Pas
بالتوفيق,,
- تقريبا نفس الفكرة في تحويل الـ XM إلى *.Pas
كود :
//04-06-2009 By TF6M
{$WARNINGS OFF}{$HINTS OFF}
{$OPTIMIZATION ON} {$O Off}
Procedure XmToBin (Path:String);
{$IF CompilerVersion >= 17}Inline;{$IFEND}
Var F: TextFile;
XmFile:File Of Byte;
Temp,Index:Byte;
Begin
Try
AssignFile(F,'XM_Bin.Pas');
ReWrite(F);
//
AssignFile(XmFile,Path);
If FileExists(Path)Then ReSet(XmFile)
Else Exit; //IoResult.
//
WriteLn(F,'Const xm : Array[1..'+
IntToStr([COLOR=Red]FileSize[/COLOR](XmFile)+1)+'] Of Byte = (');
Index:=0;
//
While Not Eof(XmFile) Do
Begin
Inc (Index);
Read(XmFile,Temp);
If Index Mod 64 = 0 Then
WriteLn(F,'$'+Inttohex(Temp,2)+',')Else
Write(F,'$'+Inttohex(Temp,2)+',');
End;
Write(F,'$00);');
CloseFile(F);
CloseFile(XmFile);
Except
Exit;
End;
End;بالتوفيق,,
I'M Fly Like A G6

