Option Strict가 On 일 때 나타나는 이진 파일의 구조체 데이터 읽기 기능에 문제가 있습니다. 구조체 데이터 복사
Public Function arh_setup(ByVal rw As Boolean) As Integer
Dim retval As Integer = 0
Dim fnum As Integer = FreeFile()
Dim temp As ValueType = CType(New aSetup, ValueType)
Try FileOpen(fnum, setup_file, OpenMode.Binary, OpenAccess.ReadWrite, OpenShare.Shared, Len(asT)) If rw Then FilePut(fnum, asT, 1) Else FileGet(fnum, temp, 1) End If FileClose(fnum) Catch ex As Exception retval = -1 End Try ' Now is question here ' How to get data from temp to asT?? EDIT: Solution is asT = CType(temp, aSetup) temp= Nothing Return retval End Function
AST 전역 (적절히) 데이터를 포함 읽혀질 온도 데이터를 입력해야 aSetup (구조)의 변수를 선언한다.
질문은 로컬 임시 변수에서 전역 asT 변수로 데이터를 복사하는 것이 좋습니다. 루프를 사용하지 않고 (바이트 단위로) 또는 그렇지 않으면 반복 할 수 없으면 어떻게해야합니까?
VB6과 매우 비슷하므로 VB6이라고 할 수 있습니다. IO.File.ReadAllBytes와 같은 내장 .NET 메서드를 사용한 경우에는 문제가 존재하지 않습니다. – test
불행히도, 우리는 "있는 그대로"의 상황을 가지고 있습니다. –