<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[QUIK -> DDE &mdash; формат файлов в каталоге archive]]></title>
	<link rel="self" href="https://quik2dde.ru/extern.php?action=feed&amp;tid=308&amp;type=atom" />
	<updated>2019-12-10T09:18:35Z</updated>
	<generator>PunBB</generator>
	<id>https://quik2dde.ru/viewtopic.php?id=308</id>
		<entry>
			<title type="html"><![CDATA[Re: формат файлов в каталоге archive]]></title>
			<link rel="alternate" href="https://quik2dde.ru/viewtopic.php?pid=2537#p2537" />
			<content type="html"><![CDATA[<p>можно грузить эти файлы в lua при помощи [url=http://www.inf.puc-rio.br/~roberto/struct/]lua struct[/url]</p>]]></content>
			<author>
				<name><![CDATA[toxa]]></name>
				<uri>https://quik2dde.ru/profile.php?id=3172</uri>
			</author>
			<updated>2019-12-10T09:18:35Z</updated>
			<id>https://quik2dde.ru/viewtopic.php?pid=2537#p2537</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[формат файлов в каталоге archive]]></title>
			<link rel="alternate" href="https://quik2dde.ru/viewtopic.php?pid=2536#p2536" />
			<content type="html"><![CDATA[<p>вот такой:<br /></p><div class="codebox"><pre><code>{$APPTYPE CONSOLE}
uses  windows, sysutils;

function readint(fh: THandle): longint;
begin if FileRead(fh, result, sizeof(result)) &lt;&gt; sizeof(result) then result:= -1; end;

function readstr(fh: THandle; maxlen: longint): ansistring;
var tmpc : ansichar;
    i    : longint;
begin
  i:= 0;
  setlength(result, maxlen);
  while (FileRead(fh, tmpc, sizeof(tmpc)) = sizeof(tmpc)) and (tmpc &lt;&gt; #0) do
    if (i &lt; maxlen) then begin
      inc(i);
      result[i]:= tmpc;
    end;
  setlength(result, i);
end;

function convertdatetime(adate, atime: longint): tDateTime;
var y, m, d  : integer;
    h, mi, s : integer;
begin
  d:= adate mod 100; adate:= adate div 100;
  m:= adate mod 100; adate:= adate div 100;
  y:= adate;
  s:= atime mod 100; atime:= atime div 100;
  mi:= atime mod 100; atime:= atime div 100;
  h:= atime;
  result:= encodedate(y, m , d) + encodetime(h, mi, s, 0);
end;

type tCandle = packed record
       o, h, l, c, v : double;
       d, t          : longint;
     end;
var  fname : ansistring;
     fh    : THandle;
     cndl  : tCandle;
     len   : longint;

begin
  fname:= paramstr(1);
  if fileexists(fname) then begin
    fh:= FileOpen(fname, fmOpenRead or fmShareDenyNone);
    try
      writeln(&#039;ver: &#039;, readint(fh));
      writeln(&#039;ID: &#039;, readstr(fh, 4096));
      repeat
        len:= FileRead(fh, cndl, sizeof(cndl));
        if len = sizeof(cndl) then
          with cndl do
            writeln(format(&#039;o: %.5f h: %.5f l: %.5f c: %.5f v: %.5f ts: %s&#039;,
                           [o, h, l, c, v, formatdatetime(&#039;DD-MM-YYYY HH:NN:SS&#039;, convertdatetime(d, t))]));
      until len &lt;&gt; sizeof(cndl);
    finally FileClose(fh); end;
  end else writeln(&#039;File &#039;, fname, &#039; not found!&#039;);
end.</code></pre></div>]]></content>
			<author>
				<name><![CDATA[toxa]]></name>
				<uri>https://quik2dde.ru/profile.php?id=3172</uri>
			</author>
			<updated>2019-12-10T09:12:56Z</updated>
			<id>https://quik2dde.ru/viewtopic.php?pid=2536#p2536</id>
		</entry>
</feed>
