you only need to call CreateCompatibleDC() once for each memory device context since GetDC() returns the same value for a given HWND. as far as saving and restoring the value of SelectObject(), it...
Type: Posts; User: legend
you only need to call CreateCompatibleDC() once for each memory device context since GetDC() returns the same value for a given HWND. as far as saving and restoring the value of SelectObject(), it...
if your program is called with command line arguments chances are the 'current directory' isn't the program directory. if so, you can extract the application's path from the first command line arg...
the way I always do it is:
- using tmpnam(), create a temp file
- write new data to temp file
- rename original file using tmpnam()
- rename temp file to original name
- delete the old file
...
you need to add the 'typename' qualifier when referencing a typedef external to a template.
typename vector<Type>::iterator begin() {
return _data.begin();
}
an easier way is to...
the hash table can be any abitrary size (but the larger the table, the less chances for collisions to occur - if the table is too small you the won't get much performance out of it), so you calculate...
another approach is to provide a typedef within the template for any internal type you may want to make accessible to other templates:
template <class DataType>
struct TestStruct {
typedef...
well, you just have to be sure to do something with the data between calls.
definately not a good idea. just add an extra parameter to the function for a destination buffer.
you pass 'domains' by value so the changes you make are performed on a copy of it. change the parameter to a char *** and you will have the variable itself - just dereference the pointer in the...
me too!
bool isPalindrome(const char * data)
{
for(const char * tail = data + strlen(data) - 1; data < tail; tail--, data++)
{
while(isspace(*data) || ispunct(*data)) data++;
...
bit shifting wouldn't be very useful if he plans to use character arrays. It would be more logical to use binary data in the first place of course.
if ( board[1] == board[4] == board[7] ){
that expression evaluates "board[1] == board[4]" first, then takes the boolean result
(1 or 0) and compares it to the cell at board[7]. you need to...
you can use the function 'clock' in a loop to create a pause effect like that.
check out www.boost.org
I was basing my advice on this from MSDN:
"MSG_PEEK: Peeks at the incoming data. The data is copied into the buffer, but is not removed from the input queue. The function subsequently returns the...
the encoding used may not yield the correct value using that method. for instance, using gray's code there's a single bit of difference between neighboring values - so subtracting values would...
int ctoi(char ch) {
char temp[2] = {ch, 0};
return atoi(temp);
}
you could use simple arithemetic on the character values too, but I'm not sure how portable that would be.
you could pass the hash generator as a template parameter (that would default to some predefined object).
you can (I think) query the recieve buffer with something like this:
needed = recv(W, &Char, 0, MSG_PEEK);
void addItem(IntList *data, int newItem, unsigned location)
{
unsigned i;
for (i=data->size;i>location;i--)
data->number[i] = data->number[i-1];
...
take a wild guess.
you're not incrementing the structure's 'size' variable each time you add an item.
why not use strtok?
you can also write a custom char_traits object and pass it as the second template parameter of basic_string to override the default comparison semantics.