掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
バイト配列の途中に代入するには (ID:9135)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
こんな感じです。 type TByteArray = array of Byte; function PFNowTo6Byte: TByteArray; var UsStr :String; UsInt :Integer; begin SetLength(result,6); UsStr := FormatDateTime('yymmddhhnnss',Now); Val(Copy(UsStr, 1,2), result[0], UsInt); Val(Copy(UsStr, 3,2), result[1], UsInt); Val(Copy(UsStr, 5,2), result[2], UsInt); Val(Copy(UsStr, 7,2), result[3], UsInt); Val(Copy(UsStr, 9,2), result[4], UsInt); Val(Copy(UsStr,11,2), result[5], UsInt); end; procedure TForm1.Button1Click(Sender: TObject); var B:TByteArray; begin B := PFNowTo6Byte; Label1.Caption := Format('■FF-%.2d-%.2d-%.2d-%.2d-%.2d-%.2d-FF■', [B[0],B[1],B[2],B[3],B[4],B[5]]); end;
←解決時は質問者本人がここをチェックしてください。
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.