Microsoft KB Archive/50469

= FIX: CopyFile Changes File Type to &quot;TEXT&quot; in Mac QuickBasic =

Article ID: 50469

Article Last Modified on 1/9/2003

-

APPLIES TO


 * Microsoft QuickBasic Compiler for Macintosh 1.0

-



This article was previously published under Q50469



SYMPTOMS
The CopyFile MBLC routine, which is built into QuickBasic, changes the file type of any file copied to type &quot;TEXT&quot; (instead of retaining the type of the copied file).

Microsoft has confirmed this to be a bug in QuickBasic version 1.00 for the Macintosh. This problem is corrected in QuickBasic version 1.00b.

To work around the problem, you can use the NAME statement to reassign the type of the file after you copy it.



MORE INFORMATION
The CopyFile MBLC routine is not documented in the QuickBasic manual, but it is documented in the README file on the release disk. For additional important information about using CopyFile, query on the following words:

CopyFile and QuickBasic and Macintosh

Example of Workaround
The following SUBprogram copies a source file to a destination file. The SUBprogram finds out what type the source file is, copies the file, and then makes the destination file the same type as the source file. REM  The following Call to MyCopyFile will copy &quot;File Browser&quot; REM  to &quot;File Searcher&quot;, and &quot;File Searcher&quot; will be the same REM  type as &quot;File Browser&quot;. DEFINT A-Z Source$ = &quot;File Browser&quot; Dest$ = &quot;File Searcher&quot; CALL MyCopyFile(Source$,Dest$)

SUB MyCopyFile(SourceFile$,DestinationFile$) STATIC

REM Get the file type of SourceFile$ using the GetFileInfo routine. REM More information about GetFileInfo can be found by querying REM under &quot;GetFileInfo and type&quot; in the Microsoft Knowledge Base.

DIM fileinfo(40) GetFileInfo SourceFile$,fileinfo(0) FILETYPE$ = &quot;&quot; FOR i = 16 TO 17 FILETYPE$ = FILETYPE$ + CHR$(fileinfo(i) \ 256) FILETYPE$ = FILETYPE$ + CHR$(fileinfo(i) AND 255) NEXT i

REM  Call CopyFile:

CopyFile SourceFile$,DestinationFile$

REM  Change the type back to the original:

NAME DestinationFile$ AS DestinationFile$, FILETYPE$ END SUB

Additional query words: MQuickB

Keywords: kbbug kbfix KB50469

-

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

© Microsoft Corporation. All rights reserved.