1. more sequence help

------=_NextPart_000_003B_01BF7A2A.C337EAA0
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Once again I throw myself at the feet of the masters and humbly beg for =
help. . . . . .=20

here is what I am trying to do

supplierfname=3D open(sname & ".dat", "w")

        printf( supplierfname, "%s", {supplierdata} )

        close(supplierfname)

what am I doing wrong?  I want to save this sequence into a file and it =
keeps giving me errors?

Help!!!

------=_NextPart_000_003B_01BF7A2A.C337EAA0
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2919.6307" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Once again I throw myself at the feet =
of the=20
masters and humbly beg for help. . . . . . </FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>here is what I am trying to =
do</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>supplierfname=3D open(sname &amp; =
".dat",=20
"w")</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
printf(=20
supplierfname, "%s", {supplierdata} )</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;=20
close(supplierfname)</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>what am I doing wrong?&nbsp; I want to =
save this=20
sequence into a file and it keeps giving me errors?</FONT></DIV>
<DIV>&nbsp;</DIV>

------=_NextPart_000_003B_01BF7A2A.C337EAA0--

new topic     » topic index » view message » categorize

2. Re: more sequence help

On Fri, 18 Feb 2000 16:11:07 -0600, Paul Sheepwash wrote:

>here is what I am trying to do
>
>supplierfname= open(sname & ".dat", "w")
>
>        printf( supplierfname, "%s", {supplierdata} )
>
>        close(supplierfname)
>
>what am I doing wrong?  I want to save this sequence into a file and it
keeps giving me errors?

If supplierdata is a sequence, then you need to write each element
individually.  One possible way to do this would be:

for i = 1 to length( supplierdata ) do
  printf( supplierfname, "%s ", {supplierdata[i]} )
end for
close(supplierfname)

Or, if you know the length of supplier data (let's say it has 4 elements)
then you could do:

printf( supplierfname, "%s %s %s %s", {supplierdata} )
close(supplierfname)

-- Brian

new topic     » goto parent     » topic index » view message » categorize

3. Re: more sequence help

Could supplierfname be a sequence instead of an integer?

Paul Sheepwash wrote:

> Once again I throw myself at the feet of the masters and humbly beg for help.
> . . . . .
>
> here is what I am trying to do
>
> supplierfname= open(sname & ".dat", "w")
>
>         printf( supplierfname, "%s", {supplierdata} )
>
>         close(supplierfname)
>
> what am I doing wrong?  I want to save this sequence into a file and it keeps
> giving me errors?
>
> Help!!!
>
>   ------------------------------------------------------------------------
>                Name: FILE.HTM
>    FILE.HTM    Type: Hypertext Markup Language (text/html)
>            Encoding: 7bit

new topic     » goto parent     » topic index » view message » categorize

4. Re: more sequence help

On Fri, 18 Feb 2000 16:44:51 -0500, Brian Broker <bkb at CNW.COM> wrote:


>Or, if you know the length of supplier data (let's say it has 4 elements)
>then you could do:
>
>printf( supplierfname, "%s %s %s %s", {supplierdata} )
>close(supplierfname)

sorry, this last example should like like this:

printf( supplierfname, "%s %s %s %s", supplierdata )
close(supplierfname)


-- Brian

new topic     » goto parent     » topic index » view message » categorize

5. Re: more sequence help

Knowing the general structure of supplierdata would be helpful.
I'm guessing that you are getting an error because you have the following
structure.
supplierdata = {"Line1", "Line2", "Line3"}
Assuming that you want the output file to look like this.

Line1
Line2
Line3

There are 2 methods to do it.  I prefer one over the other.
You could build a format sequence to use with printf(). --Bad idea.
or you could just cycle through the sequence using a loop.
In either case you will have to use a loop.

integer newline
newline = '\n'
for A = 1 to length(supplierdata) do
  puts(supplierfname, supplierdata[A] & newline)
end for

        Lucius L. Hilley III
        lhilley at cdc.net
+----------+--------------+--------------+
| Hollow   | ICQ: 9638898 | AIM: LLHIII  |
|  Horse   +--------------+--------------+
| Software | http://www.cdc.net/~lhilley |
+----------+-----------------------------+
----- Original Message -----
From: "Paul Sheepwash" <whalley99 at HOTMAIL.COM>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Friday, February 18, 2000 5:11 PM
Subject: more sequence help


> ---------------------- Information from the mail
header -----------------------
> Sender:       Euphoria Programming for MS-DOS
<EUPHORIA at LISTSERV.MUOHIO.EDU>
> Poster:       Paul Sheepwash <whalley99 at HOTMAIL.COM>
> Subject:      more sequence help
> --------------------------------------------------------------------------
-----
>
>
> ------=_NextPart_000_003B_01BF7A2A.C337EAA0
>         charset="iso-8859-1"
> Content-Transfer-Encoding: quoted-printable
>
> Once again I throw myself at the feet of the masters and humbly beg for =
> help. . . . . .=20
>
> here is what I am trying to do
>
> supplierfname=3D open(sname & ".dat", "w")
>
>         printf( supplierfname, "%s", {supplierdata} )
>
>         close(supplierfname)
>
> what am I doing wrong?  I want to save this sequence into a file and it =
> keeps giving me errors?
>
> Help!!!
>

new topic     » goto parent     » topic index » view message » categorize

6. Re: more sequence help

On Fri, 18 Feb 2000, you wrote:
> >%_Once again I throw myself at the feet of the masters and humbly beg for
> >help. . . . . .
>
> here is what I am trying to do
>
> supplierfname= open(sname & ".dat", "w")
>
>         printf( supplierfname, "%s", {supplierdata} )
>
>         close(supplierfname)
>
> what am I doing wrong?  I want to save this sequence into a file and it keeps
> giving me errors?

I always use print() and get() to write and read files of this sort, not
printf. Using print and get is  very simple, one-line of code to read or to
write the entire list, no matter how  long the list may be. Code is posted at
the end of this message.

There is a drawback to this method: the files are written in Euphoria format,
which means they are not readily readable by text editors, etc. This may also
be considered a benefit, because it makes the data a little more difficult for
the casual unauthorized browser to read.

Without more information, I can't give more specific instructions, except that
there is no way I can see for printf( supplierfname, "%s",{supplierdata}) to
work with a list of suppliers, no matter _how_ supplierdata is constructed.

 --General hints for debugging--
How far does it get before you get an error?
I'm guessing you don't have the registered version, which would have given
a detailed explanation of the error., so...
One way to debug without the registered version is to insert a trace(1) just
before this code, and step thru the code. When you get to the problem line,
the program will halt. Now you know which line is at fault, so investigate the
line for correct syntax. Assuming that it is correct, then step thru again,
this  time inspecting the data that is being handed to the function or command
in  question.

If all else fails, ask someone who has a registered version to run your program
and let you know what ex.err says.

Regards,
Irv

constant CustFileName = "C:\\Demo\\Customer.dat"
global constant  -- these are the "fields" of my customer data
 custRecordID = 1,
 custCode = 2,
 custName = 3,
 custContact = 4,
 custAddr1 = 5,
 custAddr2 = 6,
 custZip = 7,
 custPhone = 8,
 custCurr = 9,
 custPd30 = 10,
 custPd60 = 11,
 custPd90 = 12,
 custLastPayAmt = 13,
 custLastPayDate = 14,
 custRateSchedule = 15

object Customers -- container for records 1..n with above structure
         Customers = {}

----------------------------------------
global procedure ReadCustomerFile()
----------------------------------------
  fn = open(CustFileName,"r")

  if fn > 0 then -- file exists
  Customers = get(fn) -- note: no loop is necessary
  close(fn)

  if equal(Customers, {1,0}) then -- file corrupt (not in Eu fmt)
     fn = message_box("Corrupt Customer data file","Error", MB_ICONERROR)
      return
  end if

  if Customers[1] = GET_SUCCESS then
     Customers = Customers[2]          -- strip off the success flag, and
     for i = 1 to length(Customers) do -- append a unique record ID for use when
        Customers[i][custRecordID]= i  --  the records are later re-ordered
     end for
  end if -- success
  else fn = message_box( "Cannot load "&CustFileName&" file",
                                   "File Read Error",MB_OK)
  end if  -- file exists
end procedure

---------------------------
global procedure WriteCustomerFile()
---------------------------
 fn  = open(CustFileName,"w")
 if fn > 0 then
   print(fn,Customers) -- again: no loop here, entire list is written
   close(fn)
 end if
end procedure

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu