int pNumberOfBytesRead = text.Capacity;
try { result=win32.ReadFile(_Handle, text, text.Capacity, ref
pNumberOfBytesRead, 0); }
catch (Exception e) { _lastError = e; Console.WriteLine(e.Message);
return (null); }
Console.WriteLine(text + " Bytes=" + pNumberOfBytesRead + " " +
text.Length + " " + text.Capacity + " " + lpNextSize);
return (text.ToString());
[DllImport("kernel32", SetLastError = true, CharSet = CharSet.Ansi)]
public static extern bool ReadFile(IntPtr hFile,
[MarshalAs(UnmanagedType.LPStr)]StringBuilder pBuffer, int
NumberOfBytesToRead, [MarshalAs(UnmanagedType.U4)]ref int
pNumberOfBytesRead, int Overlapped);
Gives me this output:
External component has thrown an exception.
ABCD|ABCDEFGHJKL|testing|THIS IS A TEST12340 Bytes=44 44 45 44
I must have done something wrong here:
External component has thrown an exception.<
Can anyone see where the problem is?