Problem with COPY FILE

Problem with COPY FILE

Postby driessen » Mon Aug 25, 2014 2:22 pm

Hello,

Here are 2 simple lines of code :
Code: Select all  Expand view
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. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1417
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Problem with COPY FILE

Postby James Bott » Mon Aug 25, 2014 2:49 pm

Michel,

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

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Problem with COPY FILE

Postby Gale FORd » Mon Aug 25, 2014 4: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")
Gale FORd
 
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston

Re: Problem with COPY FILE

Postby fafi » Mon Aug 25, 2014 10:33 pm

Try this
Code: Select all  Expand view

    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: Select all  Expand view

    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
User avatar
fafi
 
Posts: 169
Joined: Mon Feb 25, 2008 2:42 am

Re: Problem with COPY FILE

Postby driessen » 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. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1417
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Problem with COPY FILE

Postby Gale FORd » Tue Aug 26, 2014 2:36 am

Why the ampersand. Use just the parentheses.
Gale FORd
 
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 65 guests