404 on Sat, 13 Jun 1998 15:34:41 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Syndicate: DosToMac.bas


Global FSSpec1 As Structure
                Global vRefNum1 As Word
                Global parID1 As Integer
                Global name1 As Str255[63]
Endstruct

Global FSSpec2 As Structure
                Global vRefNum2 As Word
                Global parID2 As Integer
                Global name2 As Str255[63]
Endstruct

Do Display_File_Select_Boxes
Do Initialise
Do Process_Files
Do Cleanup
End

*********************************************************
*

*
*    Display File Select Boxes

*
*********************************************************
Procedure Display_File_Select_Boxes()
Local Reply As Structure
    Local sfGood As Byte
    Local sfReplacing As Byte
    Local sfType As Integer
    Local sfFile As Char[70]
    Local sfScript As Word
    Local sfFlags As Word
    Local sfIsFolder As Byte
    Local sfIsVolume As Byte
    Local sfReserved1 As Integer
    Local sfReserved2 As Word
Endstruct

    _StandardGetFile(0,Word(1),Char("TEXT"),Reply)
    If Integer(sfGood)=0
                                End
                Else
        FSSpec1=sfFile
    Endif

    _StandardPutFile(Str255("Name of file to save"),Str255("Mac.out"),Reply)
    If Integer(sfGood)=0
                                End
                Else
        FSSpec2=sfFile
    Endif
Return

*********************************************************
*

*
*    Initialise

*
*********************************************************
Procedure Initialise()

                FSOpen FSSpec1 For Input As #1
                FSOpen FSSpec2 For Output As #2

Return

*********************************************************
*

*
*    Process Files

*
*********************************************************
Procedure Process_Files()
Local TempString As String [255]
Local FirstChar As Integer

                Repeat
                                Line Input #1,TempString
                                FirstChar=Asc(Left(TempString,1))
                                If FirstChar=10 ' Line Feed

TempString=Right(TempString,Len(TempString)-1)
                                Endif
                                Print #2,TempString
                Until Eof(1)
Return

*********************************************************
*

*
*    Cleanup

*
*********************************************************
Procedure Cleanup()

                Close #1
                Close #2
Return