Ignore:
Timestamp:
Dec 7, 2007, 12:21:58 AM (17 years ago)
Author:
イグトランス (egtra)
Message:

FileStream非同期読み書きの修正、例外処理の追加。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Include/basic/command.sbp

    r364 r391  
    158158   
    159159    Dim i = 0 As Long
    160     Dim i2 As Long, i3 As Long
    161     Dim buffer = New System.Text.StringBuilder(GetFileSize(_System_hFile[FileNumber], 0) + 1)
     160    Dim buffer = New System.Text.StringBuilder(256)
    162161    Dim temp[1] As StrChar
    163162    Dim dwAccessBytes As DWord
     
    167166        '次のデータをサーチ
    168167        Do
    169             i2=ReadFile(_System_hFile[FileNumber],temp,SizeOf (StrChar),VarPtr(dwAccessBytes),ByVal 0)
    170             If i2=0 or dwAccessBytes=0 Then
     168            Dim ret = ReadFile(_System_hFile[FileNumber],temp,SizeOf (StrChar),VarPtr(dwAccessBytes),ByVal 0)
     169            If ret=0 or dwAccessBytes=0 Then
    171170                'error
    172171                Exit Macro
     
    176175
    177176        '読み込み
    178         i3=-1
    179177        IsStr=0
    180178        While 1
    181             i3++
    182 
    183             i2=ReadFile(_System_hFile[FileNumber],temp,SizeOf (StrChar),VarPtr(dwAccessBytes),ByVal 0)
    184             If i2=0 or (i3=0 and dwAccessBytes=0) Then
     179            Dim ret = ReadFile(_System_hFile[FileNumber],temp,SizeOf (StrChar),VarPtr(dwAccessBytes),ByVal 0)
     180            If ret = 0 or dwAccessBytes = 0 Then
    185181                'error
    186182                Exit Macro
     
    188184            If temp[0]=34 Then IsStr=IsStr xor 1
    189185
    190             buffer[i3]=temp[0]
     186            buffer.Append(temp[0])
    191187            If dwAccessBytes=0 or temp[0]=0 or temp[0]=13 or temp[0]=10 or (IsStr=0 and temp[0]=Asc(",")) or (IsStr=0 and (temp[0]=32 or temp[0]=9) and _System_InputDataType[i]<>_System_Type_String) Then
    192188                If temp[0]=13 Then
     
    210206                End If
    211207
    212                 buffer[i3]=0
     208                buffer.Append(0 As StrChar)
    213209                Exit While
    214210            End If
Note: See TracChangeset for help on using the changeset viewer.