Jump to content

  • Log In with Google      Sign In   
  • Create Account

bradbobak

Member Since 07 Oct 2004
Offline Last Active Today, 12:38 AM

Posts I've Made

In Topic: Linux + file / directory listing

08 October 2015 - 03:17 PM

 Maybe stat is failing? (You may need to append the filename to the directory to pass to stat).


In Topic: Do you comment Above or Below your code?

21 June 2015 - 02:53 PM

 I generally put small comments next to the code, and bigger ones above it.

 I've voted for below as well (but not sure if it would be interpreted as such) for a case such as

 

  char buf[500];
 // read a header
 read(stream, buf, 500);
 
 // some arbritary code
 x = buf[3];
 
// file is now parsed.

In Topic: Safe endian macro

03 April 2015 - 06:31 PM

This is what I use. You might be able to extract extra checks from this. Note the disclaimer.

 

http://files.sandmines.org/sml_endian.hpp

 


In Topic: Weird if() behavior

18 October 2014 - 01:33 PM


for(int i = 1; i < 10; i++)
{
backlog[i] = backlog[i-1];
}

 

fyi, i think this is wrong.. everything will be set to backlog[0]. I think you need to do the loop in reverse.


In Topic: Win32 API, GetMessage() after PeekMessage()

20 July 2014 - 08:01 PM

afaik, PM_NOREMOVE causes the PeekMessage() to leave the message on the queue. GetMessage() then removes the message from the queue.

 

edit: although this example would probably be fine with just the PeekMessage() without the PM_NOREMOVE.


PARTNERS