umadevi
23rd September 2008, 14:32
Dear All,
I have to input a file and i need to know the number of lines in that file. for me the file itself not opening. i tried seq.open() and seq.open.local().
Thanks in Advance,
Uma.
mark_h
23rd September 2008, 17:20
Well first - is the file on the client or on the baan server? Seq.open os for the server which is what I always use. I use client2server to copy the local file up onto our unix server. I then process it using seq.open and seq.gets.
See this thread (http://www.baanboard.com/baanboard/showthread.php?t=26306&highlight=records+file) for additional information and links.
Here is a little piece of code that use in several places - I should probably create a library for it.
function domain tcbool open_file()
{
long rc
| Create temporary file to copy the PC file to
temp.file = creat.tmp.file$(bse.tmp.dir$())
temp.file = strip$(temp.file)
| Open PC file to make sure it exists.
inputfile = seq.open.local(input.file,"r",0)
if(inputfile<0) then
file_err(inputfile)
return(true)
endif
seq.close.local(inputfile)
rc = client2server(input.file,temp.file,0)
| Open Server file for processing.
inputfile = seq.open(temp.file,"r")
if(inputfile<0) then
file_err(inputfile)
return(true)
endif
return(false)
}
|Print file error messages.
function file_err(long errfile)
{
on case errfile
case -2:
title("Input file does not exist.")
break
case -13:
title("No permissions to Input file.")
break
default:
title("Error opening input file.")
break
endcase
}