FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Problem with COPY FILE
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Problem with COPY FILE
Posted: Mon Aug 25, 2014 02:22 PM
Hello,

Here are 2 simple lines of code :
Code (fw): Select all Collapse
COPY FILE &(aDocTemp+".RTF") TO &(ALLTRIM(DocDoel)+"\"+"00000001.RTF")
COPY FILE &(aDocTemp+".RTF") TO &(ALLTRIM(DocDoel)+"\"+RIGHT(STR(100000000+VAL(DCTELLER),9,0),8) + ".RTF")
Why is the first line perfectly okay and why is the second line resulting in an compiling error?

Thanks a lot in advance.

Regards,

Michel D.
Genk (Belgium)


_____________________________________________________________________________________________

I use : FiveWin for (x)Harbour v. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Problem with COPY FILE
Posted: Mon Aug 25, 2014 02:49 PM

Michel,

Have you looked at the pre-processor output? I suspect that the problem is with the variable DCTELLER.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 663
Joined: Mon Dec 05, 2005 11:22 PM
Re: Problem with COPY FILE
Posted: Mon Aug 25, 2014 04:01 PM

I am not sure you need the ampersand. Extended commands just need to be enclosed in parens.
COPY FILE (aDocTemp+".RTF") TO (ALLTRIM(DocDoel)+"\"+"00000001.RTF")

Posts: 169
Joined: Mon Feb 25, 2008 02:42 AM
Re: Problem with COPY FILE
Posted: Mon Aug 25, 2014 10:33 PM
Try this
Code (fw): Select all Collapse
    local cTo1 := &(ALLTRIM(DocDoel)+"\"+"00000001.RTF")
    local cTo2 := &(ALLTRIM(DocDoel)+"\"+RIGHT(STR(100000000+VAL(DCTELLER),9,0),8) + ".RTF")
     ? cTo1
    ? cTo2
    COPY FILE &(aDocTemp+".RTF") TO (cTo1)
    COPY FILE &(aDocTemp+".RTF") TO (cTo2)

Or this one
Code (fw): Select all Collapse
    COPY FILE (&(aDocTemp+".RTF")) TO (&(ALLTRIM(DocDoel)+"\"+"00000001.RTF"))
    COPY FILE (&(aDocTemp+".RTF")) TO (&(ALLTRIM(DocDoel)+"\"+RIGHT(STR(100000000+VAL(DCTELLER),9,0),8) + ".RTF"))


Best regards
Fafi
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Re: Problem with COPY FILE
Posted: Mon Aug 25, 2014 11:01 PM

Hello guys,

I tried everything but nothing solved the problem.
Someone suggested me to use FileCopy().
And guess what : problem solved.

Thanks a lot, all of you, for your efforts.

Regards,

Michel D.
Genk (Belgium)


_____________________________________________________________________________________________

I use : FiveWin for (x)Harbour v. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 663
Joined: Mon Dec 05, 2005 11:22 PM
Re: Problem with COPY FILE
Posted: Tue Aug 26, 2014 02:36 AM

Why the ampersand. Use just the parentheses.

Continue the discussion