Board index » off-topic » Blockwrite equivalent
I T
Delphi Developer |
I T
Delphi Developer |
Blockwrite equivalent2006-11-01 11:49:53 PM off-topic12 Hi, Does anyone know what Blockwrite() is doing? I need to rewrite this function in C# .NET. Please help. Thanks! I |
Alex
Delphi Developer |
2006-11-02 03:51:02 AM
Re:Blockwrite equivalent
I T schrieb:
QuoteHi, BlockWrite Prozedur ------------ Schreibt einen oder mehrere Records aus einer Puffervariablen. f steht für eine untypisierte Datei, buf für die Puffervariable. Count gibt die Anzahl der zu schreibenden Records an, der optionale Parameter result liefert die Anzahl der tatsächlich geschriebenen Records zurück. (count <>result -->Diskette voll). Maximal können mit einem Aufruf von BlockWrite 64 KByte Daten geschrieben werden. Syntax: BlockWrite(var f: file; var buf; count: Word var result: Word]) Siehe auch: BlockRead { Example for BlockRead and BlockWrite } program CopyFile; { Simple copy program w/NO error checking } var FromF, ToF: file; NumRead, NumWritten: Word; buf: array[1..2048] of Char; begin { Open input file } Assign(FromF, ParamStr(1)); { Record size = 1 } Reset(FromF, 1); { Open output file } Assign(ToF, ParamStr(2)); { Record size = 1 } Rewrite(ToF, 1); WriteLn('Copying ', FileSize(FromF), ' bytes...'); repeat BlockRead(FromF,buf, SizeOf(buf),NumRead); BlockWrite(ToF,buf,NumRead,NumWritten); until (NumRead = 0) or (NumWritten <>NumRead); Close(FromF); Close(ToF); end. |
John Herbster
Delphi Developer |
2006-11-02 08:08:03 AM
Re:Blockwrite equivalent
"I T" < XXXX@XXXXX.COM >wrote
QuoteDoes anyone know what Blockwrite() is doing? together with BlockWrite(,,) and BlockRead(,,), so you might want to consider the equivalent of each of these other functions, too. --JohnH {smallsort} |
Erik Lindberg
Delphi Developer |
2006-11-02 03:49:05 PM
Re:Blockwrite equivalent
Hello,
When porting an old TP application to Delphi, I re-wrote all logic by using TFileStream instead. (I replaced BlockWrite with TFileStream's Write method.) So in .NET, I guess you can use FileStream. QuoteDoes anyone know what Blockwrite() is doing? I need to rewrite this Localization specialist www.multilizer.com/ |
I T
Delphi Developer |
2006-11-03 04:14:53 AM
Re:Blockwrite equivalent
Erik,
Is it possible to send me your Delphi code? It would be easier to translate from Delphi to C#. Thanks! XXXX@XXXXX.COM "Erik Lindberg" < XXXX@XXXXX.COM >wrote in message QuoteHello, |
David Pratt
Delphi Developer |
2006-11-03 12:24:05 PM
Re:Blockwrite equivalent
In Turbo Pascal, the blockwrite and blockread functions were use to read and
write blocks of memory; useful for fast reads and writes of large quantities of data at one time. Not real sure of what the equivilent function in C# woudl be, but the equivilent C/C++ function would be fread; "I T" < XXXX@XXXXX.COM >wrote in message QuoteHi, |
Marco van de Voort
Delphi Developer |
2006-11-03 06:44:14 PM
Re:Blockwrite equivalent
On 2006-11-03, David Pratt < XXXX@XXXXX.COM >wrote:
QuoteIn Turbo Pascal, the blockwrite and blockread functions were use to read and returned in the optional 4th VAR parameter is used that returns the actual written bytes (e.g. the number of bytes that was written of a block before the error occured). Usually this will be rare, but it is wise to check that this isn't done. |
Loren Pechtel
Delphi Developer |
2006-11-05 12:49:19 AM
Re:Blockwrite equivalent
On Wed, 1 Nov 2006 09:49:53 -0600, "I T" < XXXX@XXXXX.COM >wrote:
QuoteHi, |