Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.
Dim InpFile As String Dim OutFile As String Dim hFile As Long Dim fileStruct As OFSTRUCT Dim FSize As Long Dim BytesRead As Long Dim BytesWritten As Long Dim hMem As Long Dim lpMem As Long Dim r As Long Dim bts As Byte InpFile = "input.txt" OutFile = "OUTPUT.txt" 'Get the size of the file to be read FSize = FileLen(InpFile) If FSize > 0 Then 'Allocate a block of memory equal to the size of the input file. 'hMem = GlobalAlloc(GMEM_ZEROINIT, FSize) hMem = GlobalAlloc(GPTR, FSize) If hMem <> 0 Then lpMem = GlobalLock(hMem) 'Read the file into memory hFile = OpenFile(InpFile, fileStruct, OF_READ Or _ OF_SHARE_DENY_NONE) BytesRead = hread(hFile, ByVal lpMem, FSize) MsgBox Format(BytesRead) & " bytes read into memory" r = lclose(hFile) 'Write the file back to disk to verify the file was 'read correctly hFile = OpenFile(OutFile, fileStruct, OF_CREATE Or _ OF_WRITE Or OF_SHARE_DENY_NONE) BytesWritten = hwrite(hFile, ByVal lpMem, FSize) MsgBox Format(BytesWritten) & " bytes written to output file" r = lclose(hFile) 'Free resources r = GlobalUnlock(hMem) r = GlobalFree(hMem) Else MsgBox "Not enough memory to store file" End If Else MsgBox "Input file is zero bytes in length" End If End
|Problem to the message||13||62|
|Visual Studio unable to copy the file ‘Application.Designer.vb’ from the project template to the project. Access is denied.||15||82|
|Change the path of the data source in my Excel pivot table with macro||4||27|
|Crystal reports - Formula Field code need assistance with code||17||36|
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
14 Experts available now in Live!