|
|
Title | Build a random ASCII text file for testing data transfer rates |
Keywords | ASCII, random, data file, test file |
Categories | Tips and Tricks, Files and Directories |
|
|
Thanks to Kenneth Ives.
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
|
|
|
|
|
|