Click here to Skip to main content
16,006,845 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: bind() error Pin
Joaquín M López Muñoz17-Jan-02 2:04
Joaquín M López Muñoz17-Jan-02 2:04 
QuestionWhy does this crash? Pin
User 665816-Jan-02 10:26
User 665816-Jan-02 10:26 
AnswerRe: Why does this crash? Pin
Michael Dunn16-Jan-02 10:39
sitebuilderMichael Dunn16-Jan-02 10:39 
GeneralRe: Why does this crash? Pin
User 665816-Jan-02 10:53
User 665816-Jan-02 10:53 
GeneralRe: Why does this crash? Pin
Michael Dunn16-Jan-02 11:03
sitebuilderMichael Dunn16-Jan-02 11:03 
GeneralRe: Why does this crash? Pin
User 665816-Jan-02 11:08
User 665816-Jan-02 11:08 
GeneralRe: Why does this crash? Pin
Nish Nishant16-Jan-02 13:15
sitebuilderNish Nishant16-Jan-02 13:15 
GeneralRe: Why does this crash? Pin
Mustafa Demirhan16-Jan-02 13:30
Mustafa Demirhan16-Jan-02 13:30 
Gregor S. wrote:
could you please explain what you mean?

If you are not sure if buf ends with \0, then you must at least know its length to use it. Otherwise, you may try to access out-of-bound elements.

If you know the length of buf, then you can use the following approach:

//length is the length of buf
char *sNewBuf = new char (length + 1);
memcpy (sNewBuf, buf, length);
sNewBuf [length] = '\0';
sprintf(buffer,"send() called:\r\n%s\r\n",sNewBuf);
delete sNewBuf;


This may not be the best way, but it should work! Wink | ;)

Kind regards
Mustafa Demirhan

http://www.macroangel.com

Sonork ID 100.9935:zoltrix
GeneralRe: Why does this crash? Pin
User 665817-Jan-02 7:58
User 665817-Jan-02 7:58 
GeneralRe: Why does this crash? Pin
Mustafa Demirhan17-Jan-02 13:44
Mustafa Demirhan17-Jan-02 13:44 
GeneralRe: Why does this crash? Pin
Alvaro Mendez17-Jan-02 9:33
Alvaro Mendez17-Jan-02 9:33 
GeneralRe: Why does this crash? Pin
Mustafa Demirhan17-Jan-02 10:16
Mustafa Demirhan17-Jan-02 10:16 
GeneralMicrosoft Word Documents Pin
Kevnar16-Jan-02 9:59
Kevnar16-Jan-02 9:59 
GeneralRe: Microsoft Word Documents Pin
Anders Molin16-Jan-02 11:15
professionalAnders Molin16-Jan-02 11:15 
QuestionIs there a way to only allow file previewing done in explorer to preview only certain file extensions? Pin
Bart-Man16-Jan-02 9:48
Bart-Man16-Jan-02 9:48 
AnswerRe: Is there a way to only allow file previewing done in explorer to preview only certain file extensions? Pin
Chris Losinger16-Jan-02 10:24
professionalChris Losinger16-Jan-02 10:24 
GeneralRe: Is there a way to only allow file previewing done in explorer to preview only certain file extensions? Pin
Bart-Man16-Jan-02 11:07
Bart-Man16-Jan-02 11:07 
GeneralHelp :) Pin
RobJones16-Jan-02 9:28
RobJones16-Jan-02 9:28 
GeneralRe: Help :) Pin
Joaquín M López Muñoz16-Jan-02 9:41
Joaquín M López Muñoz16-Jan-02 9:41 
GeneralRe: Help :) Pin
RobJones16-Jan-02 9:45
RobJones16-Jan-02 9:45 
GeneralMP3 Player Pin
16-Jan-02 6:24
suss16-Jan-02 6:24 
GeneralRe: MP3 Player Pin
User 665816-Jan-02 6:37
User 665816-Jan-02 6:37 
QuestionWhen must I hide my window??? Pin
Vladimir Georgiev16-Jan-02 6:08
Vladimir Georgiev16-Jan-02 6:08 
AnswerRe: When must I hide my window??? Pin
Ravi Bhavnani16-Jan-02 6:33
professionalRavi Bhavnani16-Jan-02 6:33 
GeneralRe: When must I hide my window??? Pin
Vladimir Georgiev16-Jan-02 6:40
Vladimir Georgiev16-Jan-02 6:40 

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.