Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

COPY FILE not compatible CLIPPER VS XHARBOUR

161 views
Skip to first unread message

test

unread,
May 6, 2008, 7:02:26 PM5/6/08
to
In my CLIPPER application the source it's:

set default to c:\work\
source='c:\dates\'
cfile='model_01.dbf'
copy file &(source+'model.dbf') to &cfile
work perfect
the file model_01.dbf it's copy to c:\work directory

when try in XHARBOUR same source the model_01.dbf it's copy in c:\dates
(application directory) ????

i try this:
copy file &(source+'model.dbf') to &(DefPath()+cfile)
and file model_01.dbf it's copy to c:\work directory

what it's problem ?

The command COPY FILE it's not 100% compatible with CLIPPER ?


N:dlzc D:aol T:com (dlzc)

unread,
May 6, 2008, 10:09:34 PM5/6/08
to
Dear test:

"test" <info...@easynet.ro> wrote in message
news:fvqo2p$55s$1...@aioe.org...


> In my CLIPPER application the source it's:
>
> set default to c:\work\
> source='c:\dates\'
> cfile='model_01.dbf'
> copy file &(source+'model.dbf') to &cfile
> work perfect
> the file model_01.dbf it's copy to c:\work directory

Then this violates the Clipper documentation. "SET DEFAULT" only
affects dbfs / indexes that are opened for access... not the
current "DOS" directory.

http://www.itlnet.net/Programming/Program/Reference/c53g01c/nge3619.html
... "with the exception of low level file functions."
... "low level" includes "COPY TO".


> when try in XHARBOUR same source the
> model_01.dbf it's copy in c:\dates (application directory) ????

...


> The command COPY FILE it's not 100%
> compatible with CLIPPER ?

It is.

I think you meant to issue DirChange()...
http://www.itlnet.net/Programming/Program/Reference/c53g01c/ng1b556.html

David A. Smith


Grzegorz Wojnarowski

unread,
Sep 25, 2008, 4:56:22 PM9/25/08
to


Dear David

I'm afraid you are wrong. COPY FILE in xHarbour 1.0.0 IS NOT 100% compatible
with Clipper !

Look to the Clipper documentation:
http://www.itlnet.net/Programming/Program/Reference/c53g01c/ngc3bb3.html
"COPY FILE is a file command that copies files to and from the
CA-Clipper_default_drive_and_directory ..."


I made some tests:

source:

//--- start
PROCEDURE test_cf()
LOCAL cSrc := 'src.txt'
LOCAL cDst := 'dst.txt'
SET DEFAULT TO ('defdir')
COPY FILE (cSrc) TO (cDst)
RETURN
//--- end

program: c:\test\test_cf.exe

results with Clipper 5.3b:

test 1
file: c:\test\defdir\src.txt
result: c:\test\defdir\dst.txt

test 2
file: c:\test\src.txt
result: open error: defdir\src.txt

test 3
file1: c:\test\defdir\src.txt
file2: c:\test\src.txt
result: c:\test\defdir\dst.txt (copy of file1)


results with xHarbour 1.0.0:

test 1
file: c:\test\defdir\src.txt
result: c:\test\dst.txt

test 2
file: c:\test\src.txt
result: c:\test\dst.txt

test 3
file1: c:\test\defdir\src.txt
file2: c:\test\src.txt
result: c:\test\dst.txt (copy of file1)


conclusion:

Clipper
- scr in "SET DEFAULT" dir (only)
- dst in "SET DEFAULT" dir
xHarbour
- src in "SET DEFAULT" (preferred), but if file does not exist it is taken
from program dir
- dst in program dir


my solution for xHarbour 1.0.0:

//--- start
#command COPY FILE <(cF1)> TO <(cF2)> => CopyFileOK( <(cF1)>, <(cF2)> )

PROCEDURE test_cf()
LOCAL cSrc := 'src.txt'
LOCAL cDst := 'dst.txt'
SET DEFAULT TO ('defdir')
COPY FILE (cSrc) TO (cDst)
RETURN

FUNCTION CopyFileOK( src, dst )
IF !('\' $ src) ; src := SET(_SET_DEFAULT) + '\' + src ; ENDIF
IF !('\' $ dst) ; dst := SET(_SET_DEFAULT) + '\' + dst ; ENDIF
RETURN( __CopyFile( src, dst ) )
//--- end

(as you can see I redirected in my prg standard COPY FILE ... command to my
own function CopyFileOK())


Best regards
Grzegorz


N:dlzc D:aol T:com (dlzc)

unread,
Sep 25, 2008, 8:43:30 PM9/25/08
to
Dear Grzegorz Wojnarowski:

"Grzegorz Wojnarowski" <grzegorz.w...@remove.psi.wroc.pl>
wrote in message news:gbgu3c$aa1$1...@news.onet.pl...
...


> I'm afraid you are wrong. COPY FILE in xHarbour
> 1.0.0 IS NOT 100% compatible with Clipper !

I confirm this. Will you make a bug report?
http://www.xharbour.com/support/bugreporter/index.asp?page=home

David A. Smith


0 new messages