Re: Printing numbers

new topic     » goto parent     » topic index » view thread      » older message » newer message

Sid,

If you use Gabriel Boehme's "print.e" from the archives, it's pretty easy
(and this is why it really should be in Euphoria in the first place):

<code follows>
include print.e
sequence someNumbers
someNumbers = {1,2,3,4}

procedure someProcedure()
integer outFile
outFile = open("num.txt", "w")
for n = 1 to length(someNumbers) do
   print(outFile, someNumbers[n])
   if n < length(someNumbers) then
      puts(outFile, ",")
   end if
end for
close(outFile)
end procedure
<end code>


result is:
1,2,3,4

Dan Moyer


----- Original Message -----
From: "Sid Sidebottom" <sid.sidebottom at ST.COM>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Monday, November 20, 2000 4:48 AM
Subject: Printing numbers


> Hi,
>
> OK, I've only been playing with Euphoria for a couple of years, but I have
> an elementary question that's driving me nuts.
>
> I want to take a sequence of integers and turn it into a .csv file - ie a
> text file with the numbers as numbers, with commas in between (and maybe
> semicolons for line delimiters). No braces or anything, just numbers.
>
> I've tried print, puts etc, and a couple of libraries in the archives, but
> nothing I do seems to work.
>
> It surely can't be that hard???
>
> Apologies if I'm being really stupid and have missed something blindingly
> obvious, but can anyone help?
>
> TIA
>
> Sid

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu