二维数组的问题
我的目的是为了防止溢出,数组下限到1000万的时候,保存到另一组去程序代码:
Open filename For Input As #1 Do Until EOF(1) Line Input #1, txt If txt <> "" Then ReDim Preserve sz(ws, 0 To hs) As String sz(ws, hs) = txt hs = hs + 1 If hs >= 10000000 Then Stop: hs = 0: ws = ws + 1 End If Loop Close #1
这里的数量大于1000万就会出错,用第二种方案
程序代码:
ReDim Preserve sz(5, 0 To hs) As String '读取文件内容 Open filename For Input As #1 Do Until EOF(1) Line Input #1, txt If txt <> "" Then ReDim Preserve sz(5, 0 To hs) As String sz(ws, hs) = txt hs = hs + 1 If hs >= 10000000 Then Stop: hs = 0: ws = ws + 1 hs = hs + 1 End If Loop Close #1
但是这里的redim 会把6组的下限都改成一样的,怎么破