Microsoft KB Archive/50469

From BetaArchive Wiki
Knowledge Base


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 "TEXT" (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 "File Browser"
REM   to "File Searcher", and "File Searcher" will be the same
REM   type as "File Browser".
DEFINT A-Z
Source$ = "File Browser"
Dest$ = "File Searcher"
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 "GetFileInfo and type" in the Microsoft Knowledge Base.

  DIM fileinfo(40)
  GetFileInfo SourceFile$,fileinfo(0)
  FILETYPE$ = ""
  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