Microsoft KB Archive/177143

= PRB: "Error Writing to File" Error Using a Table on a CD- ROM =

Article ID: 177143

Article Last Modified on 5/12/2003

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0 Standard Edition, when used with:
 * Microsoft Windows 95
 * Microsoft Visual FoxPro 3.0b Standard Edition, when used with:
 * Microsoft Windows 95
 * Microsoft Visual FoxPro 5.0 Standard Edition, when used with:
 * Microsoft Windows 95
 * Microsoft Visual FoxPro 5.0a, when used with:
 * Microsoft Windows 95

-



This article was previously published under Q177143



SYMPTOMS
When closing a table or executing a COPY TO or APPEND FROM command on a table that has no code page located on a CD-ROM, the following error message appears:

Error Writing To File

This error occurs only under Windows 95. Windows NT version 4.0 does not produce the error message. This message is most likely to happen with a CD- ROM drive installed on the local computer. If the CD-ROM drive is mapped over a network, the message may not occur.



CAUSE
Visual FoxPro tries to write the code page selected in the Code Page dialog box back to the table. However, since the CD-ROM is read-only, the error occurs. Visual FoxPro versions 3.0x and 5.0x running on Windows 95 cannot detect that the CD-ROM is a read-only device.



RESOLUTION
Here are four workarounds for this problem:
 * Copy the file from the CD-ROM to a read/write medium and remove the Read-Only attribute on the file. Once copied, use Cpzero.prg to set the code page to zero or another code page value. Use CPDBF to check the table's current code page. -or-


 * Click on the Option menu bar under the Tools menu pad and click the Data tab. Clear the "Prompt for Code Page" check box. -or-


 * Type SET CPDIALOG OFF in the Command window before opening the table. -or-


 * Click Cancel when Visual FoxPro prompts for a code page. This solution may only be practical if you mainly use the table interactively through the interface.



STATUS
This behavior is by design.



MORE INFORMATION
This error is more difficult to invoke when using the COPY TO and APPEND FROM commands. Depending on the size of the table, the error occurs only after many hundreds or thousands of records are copied. Therefore, the message may appear as an intermittently occurring error that is difficult to reproduce. This makes troubleshooting the problem extremely difficult.

The problem does not appear to be linked to the read-only attribute on the file. If a read-only table without a code page is located on the hard drive, Visual FoxPro does not prompt for a code page.

Steps to Reproduce Behavior
 Insert a CD-ROM that contains a Visual FoxPro table without a code page in the CD-ROM drive.  Type the following in the Visual FoxPro Command window and navigate to the CD-ROM drive and open the table: USE ?  When the Code Page dialog box appears, select the 1252-Windows ANSI code page. Close the table by issuing the USE command in the Command window and the error appears.

Additional query words: error writing file append copy cd-rom

Keywords: kbprb KB177143

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.