Ad blocker detected: Our website is made possible by displaying online advertisements to our visitors. Please consider supporting us by disabling your ad blocker on our website.
I don't why it's doing this & it's racking my brain figuring it out but here is the cod I wrote.
I want it so that when the letters AAAA count up to ZZZZ it will write into a text file & new text file every 500kb. I figure swallow my pride & ask you people.
Declare Function Increase$ (Lett As String)
' You start off with AAAA
Dim Letters As String
Letters = "AAAA"
Open "C:\My Documents\letters.txt" For Output As #1
Do
Print #1, Letters
Letters = Increase$(Letters)
Loop Until Letters = "AAAA" 'it gets AAAA again after ZZZZ (but isn't printed)
Close
End
Function Increase$ (Lett As String)
Dim RetStr As String
Dim position As Integer, flipped As Integer
RetStr = Lett
flipped = 0
position = 1
Do
' reset flag
flipped = 0
' increase the letter at specified position
If Mid$(RetStr, position, 1) = "Z" Then
Mid$(RetStr, position, 1) = "A"
flipped = -1
position = position + 1
Else
Mid$(RetStr, position, 1) = Chr$(Asc(Mid$(RetStr, position, 1)) + 1)
End If
Loop Until Not(flipped) Or position = Len(RetStr) + 1
Increase$ = RetStr
End Function
in the Open "C:\My Documents\letters.txt" For Output As #1 column when it keeps telling me there is a path error but I'm pretty sure that's the right path. If I just put the "letters.txt" & hit run a black screen comes up for an about 10 seconds then it tells me to hit continue which when I check the file it supposed to write to after, nothing in it.
I hope this wasn't to long for you people, thank you[/code]
I would suggest OPEN "scrn:" when first debugging. That way all output comes to the screen immediately and you don't have to go read files to see if your program is working.
OPEN "scrn:" FOR OUTPUT AS #1
DEFINT I
CONST A = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
FOR I1 = 1 TO 26
C1$ = MID$(A, I1, 1)
FOR I2 = 1 TO 26
C2$ = MID$(A, I2, 1)
FOR I3 = 1 TO 26
C3$ = MID$(A, I3, 1)
FOR I4 = 1 TO 26
PRINT #1, C1$ + C2$ + C3$ + MID$(A, I4, 1)
NEXT I4
NEXT I3
NEXT I2
NEXT I1
CLOSE
SYSTEM
Mac
The QBasic Forum
http://www.network54.com/Forum/13959