Click here to Skip to main content
14,923,844 members
Home / Discussions / C / C++ / MFC

C / C++ / MFC

AnswerRe: Setting printer options from C++ Pin
Hamid_RT31-Aug-08 18:09
MemberHamid_RT31-Aug-08 18:09 
Questionset limit text for combobox Pin
hariakuthota31-Aug-08 8:12
Memberhariakuthota31-Aug-08 8:12 
AnswerRe: set limit text for combobox Pin
Perspx31-Aug-08 8:30
MemberPerspx31-Aug-08 8:30 
QuestionTimerQueueTimers..A question.. Pin
montiee31-Aug-08 5:53
Membermontiee31-Aug-08 5:53 
AnswerRe: TimerQueueTimers..A question.. Pin
Mark Salsbery31-Aug-08 7:12
MemberMark Salsbery31-Aug-08 7:12 
QuestionRe: TimerQueueTimers..A question.. [modified] Pin
montiee1-Sep-08 8:39
Membermontiee1-Sep-08 8:39 
QuestionCode efficiency Pin
Evgeni5731-Aug-08 5:26
MemberEvgeni5731-Aug-08 5:26 
AnswerRe: Code efficiency Pin
Robert.C.Cartaino31-Aug-08 7:32
MemberRobert.C.Cartaino31-Aug-08 7:32 
Evgeni57 wrote:

Which of the ways more efficient:

1)Reading to fixed size buffer block of data...
2)Doing the same with two buffers...


I don't think you will get better performance by reading into your own buffer (although you might want to read up on the Stream I/O[^] functions you are using).

Your calls to fread()/fseek() (or whatever you are using) are already buffered. So, not only does the library call have to read data from the disk and into its internal buffer, but then it has to copy it out of that internal buffer and into a buffer that you specify.

The reading sequence you described is always linear and forward reading (not a whole bunch of random access). Creating and managing an explicit, home-brew buffering system is actually likely to be less efficient, more error-prone, and take longer to code/test than just reading the information you need and moving on that way. Your first call to fread() will buffer up a block of memory internally. Subsequent calls will then read from the buffered data (for performance) and get new data from the device (when needed).

Of course, the best way to proceed is to code it in the simplest manner to get it working; test it for accuracy; then determine if you need better performance and then looking for alternatives.


Robert C. Cartaino
AnswerRe: Code efficiency Pin
Mark Salsbery31-Aug-08 7:35
MemberMark Salsbery31-Aug-08 7:35 
GeneralRe: Code efficiency Pin
Evgeni5731-Aug-08 22:17
MemberEvgeni5731-Aug-08 22:17 
GeneralRe: Code efficiency Pin
Mark Salsbery1-Sep-08 7:58
MemberMark Salsbery1-Sep-08 7:58 
Questionc++ function help Pin
anjoz96631-Aug-08 4:07
Memberanjoz96631-Aug-08 4:07 
AnswerRe: c++ function help Pin
Cedric Moonen31-Aug-08 5:42
MemberCedric Moonen31-Aug-08 5:42 
QuestionSTL exception Pin
followait30-Aug-08 23:04
Memberfollowait30-Aug-08 23:04 
AnswerRe: STL exception Pin
Mark Salsbery31-Aug-08 7:47
MemberMark Salsbery31-Aug-08 7:47 
GeneralRe: STL exception Pin
followait31-Aug-08 18:00
Memberfollowait31-Aug-08 18:00 
Questionifstream question Pin
followait30-Aug-08 16:40
Memberfollowait30-Aug-08 16:40 
QuestionInvert ARGB [modified] Pin
bob1697230-Aug-08 7:12
Memberbob1697230-Aug-08 7:12 
AnswerRe: Invert ARGB Pin
Mark Salsbery30-Aug-08 8:04
MemberMark Salsbery30-Aug-08 8:04 
GeneralRe: Invert ARGB Pin
bob1697230-Aug-08 11:52
Memberbob1697230-Aug-08 11:52 
GeneralRe: Invert ARGB Pin
Mark Salsbery30-Aug-08 11:58
MemberMark Salsbery30-Aug-08 11:58 
QuestionLooking for C++ CWnd equivalent of C#'s Control.Invoke, Control.IsInvokeRequired Pin
Ohad Maishar30-Aug-08 6:13
MemberOhad Maishar30-Aug-08 6:13 
AnswerRe: Looking for C++ CWnd equivalent of C#'s Control.Invoke, Control.IsInvokeRequired Pin
Mark Salsbery30-Aug-08 6:46
MemberMark Salsbery30-Aug-08 6:46 
Questionopening network connections Pin
VCProgrammer30-Aug-08 1:50
MemberVCProgrammer30-Aug-08 1:50 
AnswerRe: opening network connections Pin
Dr. Emmett Brown30-Aug-08 3:34
MemberDr. Emmett Brown30-Aug-08 3:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.