Delphi Writeln Function

Discussion in 'Programming' started by arehman1289, Dec 2, 2013.

  1. #1
    Hello
    [​IMG]I have an array of about 8760 numbers. i need to write it in one line in delphi.
    [​IMG]if i use the writeln command like this
    [​IMG]writeln(array[1],array[2]....so on) it gets really really long. is their a shorter way.
    [​IMG]please help.
    [​IMG]thanks
     
    arehman1289, Dec 2, 2013 IP
  2. sitepos

    sitepos Greenhorn

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #2
    s:= '';
    for i:=Low(array) to High(array) do s:= s + array[i];
    writeln(s);
    Code (markup):
     
    sitepos, Dec 3, 2013 IP
  3. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,999
    Best Answers:
    253
    Trophy Points:
    515
    #3
    @sitepos -- wasteful of memory and would thrash garbage collection like a ****.

    I'd suggest using write instead of writeln, then do a writeln AFTER.

    for t:=Low(array) to High(array) do write(array[t]);
    writeln;
    Code (markup):
    Worked good in the '80's where we couldn't have arrays bigger than 64k and usually had a stack that was 16k or less...
     
    deathshadow, Dec 3, 2013 IP