Click here to Skip to main content
15,925,061 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Rename Variables Add-in Pin
toxcct7-Apr-06 3:43
toxcct7-Apr-06 3:43 
AnswerYes, at least one I know of Pin
jhwurmbach7-Apr-06 3:57
jhwurmbach7-Apr-06 3:57 
QuestionFinding my way in NYC Pin
alex__b7-Apr-06 3:19
professionalalex__b7-Apr-06 3:19 
AnswerRe: Finding my way in NYC Pin
Ravi Bhavnani7-Apr-06 7:05
professionalRavi Bhavnani7-Apr-06 7:05 
GeneralRe: Finding my way in NYC Pin
alex__b7-Apr-06 21:20
professionalalex__b7-Apr-06 21:20 
QuestionPGM image format - buffer vs file Pin
georgie.moss7-Apr-06 2:38
georgie.moss7-Apr-06 2:38 
QuestionRe: PGM image format - buffer vs file Pin
David Crow7-Apr-06 2:51
David Crow7-Apr-06 2:51 
AnswerRe: PGM image format - buffer vs file Pin
James R. Twine7-Apr-06 3:18
James R. Twine7-Apr-06 3:18 
  sprintf expects to be working with NUL-terminated strings.  If the buffer pointed to by buf + (i * W + j)*3+2 is garbage or does not have a NUL, it will keep looking for one. If that buffer contains a % it will try to format a value based on the contents of the stack, which would be bad considering to additional parameters are passed.

   Are you sure you are not trying to do something like:
temp = (unsigned char*)malloc(x * y *3+15);
  
DWORD dwIndex = 0;
  
sprintf(temp, "P6\n %d %d\n 255\n",W, H);
for(i=0;i<H;i++)
{
   for(j=0;j<W;j++)
   {         
     DWORD dwBufIndex = ( i * W + j ) * 3 + 2;
  
     temp[ dwIndex++ ] = buf[ dwBufIndex ];   <code>// 3+2</code>
     temp[ dwIndex++ ] = buf[ --dwBufIndex ]; <code>// 3+1</code>
     temp[ dwIndex++ ] = buf[ --dwBufIndex ]; <code>// 3+0</code>
   }
}
   My math/indices may be off but I am sure you get what I am talking about...

   Peace!

-=- James
If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong!
Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road!
DeleteFXPFiles & CheckFavorites
(Please rate this post!)
GeneralRe: PGM image format - buffer vs file Pin
georgie.moss10-Apr-06 14:45
georgie.moss10-Apr-06 14:45 
QuestionStatus Bar Problem Pin
si_697-Apr-06 1:56
si_697-Apr-06 1:56 
AnswerRe: Status Bar Problem Pin
James R. Twine7-Apr-06 2:02
James R. Twine7-Apr-06 2:02 
QuestionA CString question Pin
<color>Aljechin 7-Apr-06 1:29
<color>Aljechin 7-Apr-06 1:29 
AnswerRe: A CString question Pin
si_697-Apr-06 1:31
si_697-Apr-06 1:31 
GeneralRe: A CString question Pin
Ștefan-Mihai MOGA7-Apr-06 1:35
professionalȘtefan-Mihai MOGA7-Apr-06 1:35 
GeneralRe: A CString question Pin
toxcct7-Apr-06 2:22
toxcct7-Apr-06 2:22 
JokeRe: A CString question Pin
jhwurmbach7-Apr-06 2:29
jhwurmbach7-Apr-06 2:29 
GeneralRe: A CString question Pin
toxcct7-Apr-06 2:55
toxcct7-Apr-06 2:55 
AnswerRe: A CString question Pin
Cedric Moonen7-Apr-06 1:38
Cedric Moonen7-Apr-06 1:38 
GeneralRe: A CString question Pin
<color>Aljechin 7-Apr-06 1:48
<color>Aljechin 7-Apr-06 1:48 
AnswerRe: A CString question Pin
James R. Twine7-Apr-06 1:57
James R. Twine7-Apr-06 1:57 
GeneralRe: A CString question Pin
<color>Aljechin 7-Apr-06 2:00
<color>Aljechin 7-Apr-06 2:00 
GeneralRe: A CString question Pin
Cedric Moonen7-Apr-06 1:58
Cedric Moonen7-Apr-06 1:58 
GeneralRe: A CString question Pin
Roger Stoltz7-Apr-06 1:59
Roger Stoltz7-Apr-06 1:59 
GeneralRe: A CString question Pin
<color>Aljechin 7-Apr-06 2:04
<color>Aljechin 7-Apr-06 2:04 
GeneralRe: A CString question Pin
jhwurmbach7-Apr-06 2:40
jhwurmbach7-Apr-06 2: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.