Using gets (0)

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

Hi:

  I'm trying to prompt the user for an output filename, into which I will
write data.   The following code segment will work IF I declare the output
file in the source code (the  "commented - out" line below).  But, if I try
to type it in (when prompted) I get the failure to open output file message.

  I've tried entering the pathname  [d:\aa\dataout.txt] with single, and
double- backslashes (" \ ", and " \\ ").  Both give Error message.  I've
also tried stripping-off the "\n" -- no difference.

  Anyone can show me what simple thing I'm missing?   Thanks.

  -- Bob Hancock ,     [bob at speed.net]

 = = = = = = = = = = = = = = = = = = = = =

include get.e

sequence   filein,   fileout
filein   =   "d:\\aa\\datain.txt"
 --   fileout = "d:\\aa\\dataout.txt"    <<  ... this will work...  >>

integer   fn, fo

puts(1,"What is Name of Output File ?\n")
fileout = gets(0)

printf(1, "\n\n The OUTPUT  is ... %s \n",{fileout})    -- for troubleshooting

fo = open(fileout, "w")

if fo = -1 then
    puts(2, "\nCouldnt Open Output File\n")   <<-- Failure appears Here!
end if

 = = = = = = = = = = = = = = = = = = =



 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
          Bob Hancock        ...      ======>bob at speed.net<========
              Irvine, CA

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

Search



Quick Links

User menu

Not signed in.

Misc Menu