Форум программистов
 

Восстановите пароль или Зарегистрируйтесь на форуме, о проблемах и с заказом рекламы пишите сюда - alarforum@yandex.ru, проверяйте папку спам!

Вернуться   Форум программистов > Клуб программистов > Свободное общение
Регистрация

Восстановить пароль
Повторная активизация e-mail

Купить рекламу на форуме - 42 тыс руб за месяц

Ответ
 
Опции темы Поиск в этой теме
Старый 02.02.2010, 19:26   #1
Pedro
Форумчанин
 
Аватар для Pedro
 
Регистрация: 25.03.2007
Сообщений: 166
По умолчанию Write или WriteBuffer?

Здравствуйте!
Вот у многих компонентов есть метод write/read и writebuffer/readbuffer. Например в tmemorystream. Так вот, если не сложно, объясните в чем разница, и что из этого, в каких случаях используется? Заранее благодарю...
Pedro вне форума Ответить с цитированием
Старый 02.02.2010, 19:34   #2
mihali4
*
Старожил
 
Регистрация: 22.11.2006
Сообщений: 9,201
По умолчанию

Волшебная клавиша F1 рассказывает обо всем вполне доступно...
Вам перевод нужен ?
mihali4 вне форума Ответить с цитированием
Старый 02.02.2010, 21:29   #3
Pedro
Форумчанин
 
Аватар для Pedro
 
Регистрация: 25.03.2007
Сообщений: 166
По умолчанию

К сожалению ни в delphi 2009 ни в 7 нет справки. Ну ничего, найду где-нибудь. Спасибо
Pedro вне форума Ответить с цитированием
Старый 02.02.2010, 21:45   #4
MalCer
Форумчанин
 
Аватар для MalCer
 
Регистрация: 15.07.2008
Сообщений: 615
По умолчанию

Вот вам из справки о методе Write():
Цитата:
Writes Count bytes from Buffer to the current position in the memory buffer and updates the current position by Count bytes.

Delphi syntax:

function Write(const Buffer; Count: Longint): Longint; override;

C++ syntax:

virtual int __fastcall Write(const void *Buffer, int Count);

Description

Use Write to insert Count bytes into the memory buffer of the memory stream, starting at the current position. Write will increase the size of the memory buffer, if necessary, to accommodate the data being written in. If the current position is not the end of the memory buffer, Write will overwrite the data following the current position.

Write updates the Size property to Position + Count, and sets the Position property to the new value of Size. Thus, any data that was stored in the memory stream in the Count bytes after the current position is lost when calling Write.

Write always writes the Count bytes in the Buffer, unless there is a memory failure. Thus, for TMemoryStream, Write is equivalent to the WriteBuffer method.

All other data-writing methods of a memory stream (WriteBuffer, WriteComponent) call Write to do the actual writing.
Итого WriteBuffer - это специальный буфер в памяти потока. Ес-но мы должны знать размер буфера. А read и readbuffer по аналогии
xor eax, eax
xchg [eax], eax
MalCer вне форума Ответить с цитированием
Старый 03.02.2010, 02:03   #5
mihali4
*
Старожил
 
Регистрация: 22.11.2006
Сообщений: 9,201
По умолчанию

А чего ж вы сразу не привели заодно:
Цитата:
Writes Count bytes from Buffer onto the stream and advances the current position of the stream by Count bytes.

Delphi syntax:

procedure WriteBuffer(const Buffer; Count: Longint);

C++ syntax:

void __fastcall WriteBuffer(const void *Buffer, int Count);

Description

Use WriteBuffer to save data to a stream. WriteBuffer and ReadBuffer are used in cases where the number of bytes is known and required, for example when reading in structures. Use WriteBuffer for standard file I/O streaming.

WriteBuffer is used internally for writing to a stream and copying from a stream. It is used by other objects, such as strings and lists, for writing strings stored in a buffer.

WriteBuffer calls Write to handle the actual writing. If the stream fails to write all the requested bytes, an EWriteError exception is raised.
Сил не хватило ?
mihali4 вне форума Ответить с цитированием
Ответ


Купить рекламу на форуме - 42 тыс руб за месяц



Похожие темы
Тема Автор Раздел Ответов Последнее сообщение
document.write Flamberg JavaScript, Ajax 1 10.01.2010 15:07
Write a class that can be created only in a single instance and only by some specific method. Swool Общие вопросы C/C++ 5 31.10.2009 22:24
Нelp write a program Alexxx92 Помощь студентам 0 04.06.2009 17:05
Как обратиться к линку из document.write ? Navsad JavaScript, Ajax 8 31.01.2009 17:08
Как удалить write-protection с флэшки? forever Компьютерное железо 6 28.02.2008 14:22