Recent

Author Topic: Is it possible to pass a pointer as a untyped parameter?  (Read 6787 times)

rvk

  • Hero Member
  • *****
  • Posts: 4465
Re: Is it possible to pass a pointer as a untyped parameter?
« Reply #15 on: September 18, 2015, 10:57:11 pm »
Simply I used TfileStream.REad instead of TfileStream.REadbuffer, and worked!  %) %)
That's what I already suggested in post #3  :D Read() does not throw an exception when it encounters an error (or end of file which is unlikely in the event of a volume-read).

Read does return the number of bytes it actually read (it's a function). Could you check if it actually read 512 bytes???

If it didn't you could use GetLastError to check what error was actually given by the OS.

In programming sometimes it´s better not asking why, simply it works.
Mmm, I don't quite agree. When something like this happens I normally would like to know what was the cause. It might happen again (unexpectedly) and if it happens in a production program the client is the one who gets stuck with this problem. When you know what caused it you could take steps to make sure it never happens again in your program.

Ign_17

  • New Member
  • *
  • Posts: 38
Re: Is it possible to pass a pointer as a untyped parameter?
« Reply #16 on: September 19, 2015, 12:37:48 am »
Quote
Read does return the number of bytes it actually read (it's a function). Could you check if it actually read 512 bytes???

Yes, I have configured it to read the MBR sector and reads correctly the 512 bytes.


In programming sometimes it´s better not asking why, simply it works.
Quote
Mmm, I don't quite agree. When something like this happens I normally would like to know what was the cause. It might happen again (unexpectedly) and if it happens in a production program the client is the one who gets stuck with this problem. When you know what caused it you could take steps to make sure it never happens again in in your program.

Of course, you are rigth. It´s just a joke :-)
Thank you so much for your help.

 

TinyPortal © 2005-2018