News:

MyKidsDiary.in :: Capture your kids magical moment and create your Online Private Diary for your kids

Main Menu

Build a random ASCII text file for testing data transfer rates

Started by nandagopal, Nov 17, 2008, 07:43 PM

Previous topic - Next topic

nandagopal

The program does some work to calculate the size of the file it should build and to insert carriage returns. The main piece is the following code that generates a random printable ASCII character. See the code for additional details.


' Create the random printable characters
' (ASCII value between 33 and 126 inclusive)
iChar = 33 + Int(Rnd * (126 - 33 + 1))
sChar = Chr(iChar)
sTmpRec = sTmpRec & sChar

' If the temporary string is 78 characters
' long then append it to the final output
' string
If Len(sTmpRec) = 78 Then
    sOutRec = sOutRec & sTmpRec
    sTmpRec = ""
End If

' Increment the Byte and column counters
lByteCnt = lByteCnt + 1
lCnt = lCnt + 1

iChar = Int(Rnd * 125) + 1