どこが間違っているのでしょうか?
Posted: 2007年1月15日(月) 13:03
次のクラスを含むコードをコンパイルしようとすると
次のようなエラーが出ます
どこが間違っているのかわかりません
どなたか教えてください
コード: 全て選択
Class StrList
Private
dim pStr as *BytePtr
dim nHasStr as long
dim nShowed as long
Public
sub StrList()
pStr=malloc(sizeof(Byte)*256)
nHasStr=0
nShowed=0
end sub
sub ~StrList()
dim i as Long
for i = 0 to nHasStr-1
free(pStr)
next i
free(pStr)
end sub
function GetnHasStr() as Long
GetnStr=nHasStr
end function
function PutStr(ss as BytePtr)as long
dim q as *BytePtr
dim i as Long
if nHasStr>=2000000000 then
PutStr=-1
Exit Function
elseif nHasStr mod 256 = 0 then
q=pStr
pStr=malloc(sizeof(Byte)*(nHasStr+256))
for i=0 to nHasStr-1
pStr=q
next i
End if
pStr[nHasStr]=malloc(sizeof(Byte)*lstrlen(ss))
lstrcpy(pStr[nHasStr],ss)
nHasStr=nHasStr+1
PutStr=nHasStr
end function
function GetStr(ss as BytePtr)as long
if nShowed>=nHasStr then
GetStr=-1
else
strcpy(ss,pStr[nShowed])
GetStr=0
end if
end function
end class
次のようなエラーが出ます
コード: 全て選択
MainWnd.sbp(16) - "pStr" 無効な識別子です
MainWnd.sbp(17) - "nHasStr" 無効な識別子です
MainWnd.sbp(18) - "nShowed" 無効な識別子です
MainWnd.sbp(23) - "nHasStr" 無効な識別子です
MainWnd.sbp(24) - "pStr" 無効な識別子です
MainWnd.sbp(26) - "pStr" 無効な識別子です
MainWnd.sbp(38) - "nHasStr" 無効な識別子です
MainWnd.sbp(42) - "pStr" 無効な識別子です
MainWnd.sbp(45) - "pStr" 無効な識別子です
MainWnd.sbp(47) - "End If" の使い方が不正です
MainWnd.sbp(49) - "pStr[nHasStr]" 無効な識別子です
どこが間違っているのかわかりません
どなたか教えてください