次のようなプログラムを実行したところ・・・・、
コード:
Open "data52.txt" For Input As 1
Dim I, Str$
While Eof(1) = 0
I++
Input #1,Str$
Print I
Wend
Close(1)
「data52.txt」(約30KB)のファイルデータは下のような感じで「0」と「,」が、ず~っとつながっているのですが、
コード:
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
なぜか、(毎回バラバラですが、)約6000回くらい読み込んだころにエラーがでます。
「string.sbp」に「_System_HeapStringAlloc」という関数がありますが、
[ここをクリックすると内容が表示されます] [ここをクリックすると非表示にします]
コード:
Function _System_HeapStringAlloc(length As DWord) As *Byte
_System_HeapStringAlloc=(HeapAlloc(_System_hProcessHeap,HEAP_ZERO_MEMORY,4+length+1)+4) As *Byte
SetDWord(_System_HeapStringAlloc-4,length)
EnterCriticalSection(_System_CriticalSection)
_System_AllocatedStringInfo.pAddress=(HeapReAlloc(_System_hProcessHeap,0,_System_AllocatedStringInfo.pAddress,(_System_AllocatedStringInfo.num+1)*4)) As *DWord
SetDWord(_System_AllocatedStringInfo.pAddress+_System_AllocatedStringInfo.num*SizeOf(DWord),_System_HeapStringAlloc)
_System_AllocatedStringInfo.num=_System_AllocatedStringInfo.num+1
LeaveCriticalSection(_System_CriticalSection)
End Function
その「SetDWord(_System_HeapStringAlloc-4,length)」でエラーが発生しているみたいです。