Click here to Skip to main content
15,883,889 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHow to free the variable Pin
goldenrose912-Feb-11 4:47
goldenrose912-Feb-11 4:47 
AnswerRe: How to free the variable Pin
Yusuf12-Feb-11 5:04
Yusuf12-Feb-11 5:04 
GeneralRe: How to free the variable Pin
goldenrose912-Feb-11 5:10
goldenrose912-Feb-11 5:10 
GeneralRe: How to free the variable Pin
Aescleal12-Feb-11 5:19
Aescleal12-Feb-11 5:19 
GeneralRe: How to free the variable Pin
goldenrose912-Feb-11 6:23
goldenrose912-Feb-11 6:23 
GeneralRe: How to free the variable Pin
Aescleal12-Feb-11 10:07
Aescleal12-Feb-11 10:07 
AnswerRe: How to free the variable PinPopular
Aescleal12-Feb-11 5:17
Aescleal12-Feb-11 5:17 
GeneralRe: How to free the variable [modified] Pin
Niklas L12-Feb-11 6:30
Niklas L12-Feb-11 6:30 
Since you're bringing performance up, the output parameter alternative might be a lot faster under some conditions. Especially when you're calling read_from_file() several times in a loop, which is most likely.
std::vector<char>& read_from_file( std::size_t bytes_to_read, std::vector<char> &bytes_read )
{
    bytes_read.reserve( bytes_to_read );
    std::size_t number_bytes_read = 0;
    ReadFile( handle_of_file, &bytes_read[ 0 ], &number_of_bytes_read, 0 );
    bytes_read.resize(number_of_bytes_read);
    return bytes_read;
}

Edit: Forgot to resize the vector.
home
modified on Saturday, February 12, 2011 12:57 PM

GeneralRe: How to free the variable [modified] Pin
goldenrose912-Feb-11 7:30
goldenrose912-Feb-11 7:30 
GeneralRe: How to free the variable Pin
Niklas L12-Feb-11 8:18
Niklas L12-Feb-11 8:18 
GeneralRe: How to free the variable PinPopular
Aescleal12-Feb-11 10:02
Aescleal12-Feb-11 10:02 
GeneralRe: How to free the variable Pin
Niklas L12-Feb-11 12:56
Niklas L12-Feb-11 12:56 
GeneralRe: How to free the variable Pin
Stefan_Lang13-Feb-11 21:58
Stefan_Lang13-Feb-11 21:58 
GeneralRe: How to free the variable Pin
Niklas L13-Feb-11 23:28
Niklas L13-Feb-11 23:28 
GeneralRe: How to free the variable Pin
Stefan_Lang14-Feb-11 0:18
Stefan_Lang14-Feb-11 0:18 
GeneralRe: How to free the variable Pin
Aescleal12-Feb-11 10:10
Aescleal12-Feb-11 10:10 
QuestionMessage to response function SetFont() Pin
includeh1012-Feb-11 3:38
includeh1012-Feb-11 3:38 
AnswerRe: Message to response function SetFont() Pin
Code-o-mat12-Feb-11 6:52
Code-o-mat12-Feb-11 6:52 
AnswerRe: Message to response function SetFont() Pin
User 742933813-Feb-11 2:57
professionalUser 742933813-Feb-11 2:57 
AnswerRe: Message to response function SetFont() Pin
Hans Dietrich12-Feb-11 6:53
mentorHans Dietrich12-Feb-11 6:53 
QuestionCEdit Box Error Pin
raju_shiva12-Feb-11 0:40
raju_shiva12-Feb-11 0:40 
AnswerRe: CEdit Box Error Pin
Richard MacCutchan12-Feb-11 2:04
mveRichard MacCutchan12-Feb-11 2:04 
QuestionUsing gdiplus to skew, rotate and resize a matrix (image) Pin
Kiran Satish11-Feb-11 13:43
Kiran Satish11-Feb-11 13:43 
AnswerRe: Using gdiplus to skew, rotate and resize a matrix (image) Pin
Rozis14-Feb-11 10:34
Rozis14-Feb-11 10:34 
QuestionNew Company Pin
VonHagNDaz11-Feb-11 3:27
VonHagNDaz11-Feb-11 3:27 

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.