May 12, 2010

WinTask - CreateFile()


'
' CreateFile - Create a file of arbitrary length
'
' Author: Joe Strazzere
'

Function CreateFile(Location$, Length)
    Local MyStr$, Target, Main1000, Main100, Remain, Index
    MyStr$=""

    Target = Length
    Main1000 = Target / 1000
    Main100 = (Target mod 1000) / 100
    Remain = Target mod 100

    Index = 0
    While Index < Main1000
        MyStr$ = MyStr$ + "JSS.................................................................................................JSS.................................................................................................JSS.................................................................................................JSS.................................................................................................JSS.................................................................................................JSS.................................................................................................JSS.................................................................................................JSS.................................................................................................JSS.................................................................................................JSS................................................................................................."
        Index = Index + 1
    Wend

    Index = 0
    While Index < Main100
        MyStr$ = MyStr$ + "JSS................................................................................................."
        Index = Index + 1
    Wend

    Index = 0
    While Index < Remain
        MyStr$ = MyStr$ + "."
        Index = Index + 1
    Wend

    'MsgBox(Len(MyStr$))
    Write(Location$,MyStr$)
EndFunction

CreateFile("c:\joetest.txt",123456)