OS error when trying to write to a file

This forum is for eXpress++ general support.
Post Reply
Message
Author
User avatar
Tim K
Posts: 51
Joined: Thu Jun 03, 2010 3:55 pm

OS error when trying to write to a file

#1 Post by Tim K »

My app is giving this error at startup only on the first time it is run at each workstation. The second time it is started, it runs fine. It's writing to a file on a local drive.

Date : 12/28/15
Time : 09:10:56
Procedure : DC_PRINTER:INIT
Line Number : 596
Information : Error BASE/4
Description : Operating system error
Operation : set
Thread ID : 1
Source :
Called from : (B)INIT: _DCINIT(28)
Called from : DC_PRINTER:INIT(596)
Called from : DC_PRINTERON(3621)
Called from : STARTUP(370)
Called from : MCP(100)
Called from : MAIN(48)

This is the line of code:

BATFILE := "C:\POS\Z"+ALLTRIM(STR(G_STORENUM))+".BAT"
DCPRINT ON TEXTONLY OUTFILE (BATFILE) OVERWRITE

Suggestions?

User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: OS error when trying to write to a file

#2 Post by rdonnay »

TEXTONLY mode uses the old Clipper style SET PRINTFILE TO <x>.
I don't know why this fails the first time.
Maybe a TEMP folder is needed.
Have you checked to see if a TEMP or TMP folder gets created?
Does the C:\POS folder already exist before running the first time?
The eXpress train is coming - and it has more cars.

User avatar
Tim K
Posts: 51
Joined: Thu Jun 03, 2010 3:55 pm

Re: OS error when trying to write to a file

#3 Post by Tim K »

The C:\POS folder is most definitely there. Is there another method to do the same thing that I could use as a workaround?

skiman
Posts: 1199
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: OS error when trying to write to a file

#4 Post by skiman »

Hi,

Write it with low level functions. There is also a memowrit() function, but this may have problems with the eof character.

Code: Select all


BATFILE := "C:\POS\Z"+ALLTRIM(STR(G_STORENUM))+".BAT"
cText := "Whatever you need in your bat file."
abomemowrite(batfile,cText)


function abomemowrite(cTargetFile,cBuffer)
******************************************
Local nTarget := FCreate( cTargetFile, FC_NORMAL )

if nTarget == -1
    return .F.
  else
    FWrite( nTarget, cBuffer)
    FClose(ntarget)
endif 
    
return .T.
Best regards,

Chris.
www.aboservice.be

User avatar
Tim K
Posts: 51
Joined: Thu Jun 03, 2010 3:55 pm

Re: OS error when trying to write to a file

#5 Post by Tim K »

Thanks, Chris!

User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: OS error when trying to write to a file

#6 Post by rdonnay »

Write it with low level functions.
I was going to suggest that too, however I think that TEXT INTO is more appropriate for this project.

Code: Select all

BATFILE := "C:\POS\Z"+ALLTRIM(STR(G_STORENUM))+".BAT"

TEXT INTO cText WRAP
This is all of
the stuff that
I want in my batch
file.
ENDTEXT
abomemowrite(batfile,cText)
The eXpress train is coming - and it has more cars.

Post Reply