f.martel
29th August 2012, 10:17
Ia oran !
I have a problem when i read a client file.
My local file
747056
747057
My code
...
num.fichier.r = seq.open.local(nom.fichier.r,"r",0)
...
test_fin_fichier.r = seq.read.local(buff_fichier.r,size,num.fichier.r)
while test_fin_fichier.r >= 0
...
info = buff_fichier.r
...
endwhile
...
seq.close.local(num.fichier.r)
...
This scrip return for buff_fichier.r :
747056\r\n747057\r\n
an not
747056
747057
Edit:
The file is result of barcode scan with Motorola CS3000
The client is on Windows XP
The server on Linux
HAve you anny sugestion ?
Thanks
François
ulrich.fuchs
29th August 2012, 11:22
Not sure if it helps, but try
seq.open.local(nom.fichier.r,"rt",0)
instead of
seq.open.local(nom.fichier.r,"r",0)
to indicate it's a text file
best regards
Uli
f.martel
29th August 2012, 13:39
Ia orana Ulrich !
I try your solution but when a use " rt " the function seq.open.local return 0 end the file is not open :( ...
François
mark_h
29th August 2012, 14:42
Have you tried reducing the size to 6 to see if that works?
On a side note I played with this early on without much success since the lines in my files were not fixed length. My solution was to always use client2server to move the file from the desktop to a temp file on our unix servers. Then open the file for reading. I only used seq.opn.local to make sure the file exists.
mark_h
29th August 2012, 14:46
If it helps here is the code we use in many places:
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)
}
Then once we finish reading the file we do this:
rc = seq.close(inputfile)
rc = seq.unlink(temp.file)
Now that I think about I wonder why did not create a library to hold a funtion like this.
mark_h
29th August 2012, 14:53
And to follow-up - you can read this thread here (http://www.baanboard.com/baanboard/showthread.php?t=12743&highlight=read+local+files&page=2). A potential solution at the end if you do not like the client2server option and your records are not a fixed length.
bdittmar
29th August 2012, 16:03
Ia oran !
I have a problem when i read a client file.
My local file
747056
747057
My code
...
num.fichier.r = seq.open.local(nom.fichier.r,"r",0)
...
test_fin_fichier.r = seq.read.local(buff_fichier.r,size,num.fichier.r)
while test_fin_fichier.r >= 0
...
info = buff_fichier.r
...
endwhile
...
seq.close.local(num.fichier.r)
...
This scrip return for buff_fichier.r :
747056\r\n747057\r\n
an not
747056
747057
Edit:
The file is result of barcode scan with Motorola CS3000
The client is on Windows XP
The server on Linux
HAve you anny sugestion ?
Thanks
François
Hello,
looks like your seq.local... needs the unix-like lines.
If possible try to change your scanner settings from CR/LF (For WIN) to LF (UNIX/LINUX)
So your file should look like :
747056\n
747057\n
For most Barcodescanners you're able to change these settings.
-----------------------------------------------------------------------
Motorola CS3000
Data Options
Transmit Code ID Character 0x2D None 3-17
Prefix/Suffix Values
Prefix
Suffix 1
Suffix 2
0x69
0x68
0x6A
NULL
LF
CR
3-18
Scan Data Transmission Format 0xEB Data as is 3-19
Prefix/Suffix Values
Parameter # P = 0x69, S1 = 0x68, S2 = 0x6A
Append a prefix and/or one or two suffixes to scan data for data editing. To set these values, scan a four-digit
number (i.e., four bar codes) that corresponds to ASCII values. See Table B-6 on page B-7 and Numeric Bar
Codes on page 4-48. To change the selection or cancel an incorrect entry, scan Cancel on page 4-50. To set the
Prefix/Suffix values via serial commands, see Setting Prefixes and Suffixes on page B-7.
Scan Prefix
Scan Suffix 1
Scan Suffix 2
Data Format Cancel
NOTE In order to use Prefix/Suffix values, set the Scan Data Transmission Format on page 3-19.
NOTE The CS3000 series scanner does not support ADF, however it does allow setting prefix and suffix values
via parameter bar codes.
Regards
f.martel
30th August 2012, 08:50
Ia Orana !
@bdittmar : Thank's for yout idea but my Barcodescanner was already set with settings from CR/LF (For WIN) to LF (UNIX/LINUX)
@Mark : Thank's, the transfert to server work find
Regard's
François