Hi! I have the following problem - I want to set my C++ application's Base priority to 31 if that is possible or at least set its current priority to 31.
So I need a simple example like
set priority to 31;
for (i=0;i<100000;++i) { printf("hello world"); }
set priority to 8 or keep 31 if possible
...
void move_paddle(PADDLE pad, bool alongX)
{
if(alongX!=TRUE)
{
if((pad.py+pad.length/2)>=B || (pad.py-pad.length/2)<=BB)
pad.pvx*= -1;
}
else if((pad.px+pad.length/2)>=A || (pad.py-pad.length/2)<=AA)
pad.pvx*= -1;
}
What is the actual error ? M unable to get through.
...
I am learning how to network program using c/c++ and I have created a server(TCP) that is suppose to respond in specific ways to messages from a client in order to do this I created a class that the server class passes the message to and returns a string to report back to the client.
Here is my problem sometimes it reports the correct s...
#include<stdio.h>
#include<stdlib.h>
#define MAX 1000
struct island{ double left; //gobal
double right;
} island[MAX];
...
int cmp(const void *ptr1,const void *ptr2 )
{
return (*(struct island*)ptr1).right > (*(struct island*)ptr2).right;
}
qsort(island,num,sizeof(island[0]),cm...
Everytime I use this my avlRotate function, it drops some elements from the tree.
z is the node in which imbalance was detected, y is its subtree node having the greater height, x is the newly inserted node.
This function is called immediately after a single insertion.
#define RESTRUCTURE a->left = t0; a->right = t1; c->left = t2; c->...
What must this code segment return ? 16 16 16 right ?
int main(int argc,char *argv[])
{
int a=2,*f1,*f2;
f1=f2=&a;
*f2+=*f1+=a+=2.5;
printf("%d %d %d\n",a,*f1,*f2);
return 0;
}
strangely, it returns 8 8 8 to me ???? :-(
...
In x86 assembly, the overflow flag is set when an add or sub operation on a signed integer overflows, and the carry flag is set when an operation on an unsigned integer overflows.
However, when it comes to the inc and dec instructions, the situation seems to be somewhat different. According to this website, the inc instruction does not...
It's quite a simple C code to read a file text, I've done this other times but don't know why now the ReadFile function keeps returning FALSE meaning it fails.
Obviously the text file input.txt exists and the CreateFile function succeeds (or at least doen't return INVALID_HANDLE_VALUE
#include <stdio.h>
#include <windows.h>
int main(i...
I have an error and a warning while trying to compile my linked list implementation in c
warning: assignment from incompatible pointer type
error: dereferencing pointer to incomplete type
here is the list.h
#ifndef LIST_H
#define LIST_H
#include <stdio.h>
typedef struct _ListElmt{
void *data;
struct ListElmt...
Hi all
I have a dll written in C.
I would like to send data to a socket and receive the answer in the same function.
e.g.:
BOOL SendToSocketAndRecv(...)
{
// ...
send(...);
retval = recv(...);
// ...
}
In another word, my dll should not follow Client Server pattren.
Is this possible ?
any help ?
Thank you - Kha...
Man, pointers continue to give me trouble. I thought I understood the concept.(Basically, that you would use *ptr when you want to manipulate the actual memory saved at the location that ptr points to. You would just use ptr if you would like to move that pointer by doing things such as ptr++ or ptr--.) So, if that is the case, if you...
struct DVDInfo *ReadStruct( void ) {
struct DVDInfo *infoPtr;
int num;
char line[ kMaxLineLength ];
char *result;
infoPtr = malloc( sizeof( struct DVDInfo ) );
if ( NULL == infoPtr ) {
printf( "Out of memory!!! Goodbye!\n" );
exit( 0 );
}
printf( "Ent...
Hello,
someone asked how to get the value of a JSObject property from c. That helped me a bit.
But, does anyone know how to get the current JavaScript name of an object from c?
example:
var foo={prop:'bar'};
then somewhere for example in jsapi.cpp:
JS_somemethod(JSContext *cx, JSObject *obj){
//how do i get the name 'foo' (or the...
struct DVDInfo *ReadStruct( void ) {
struct DVDInfo *infoPtr;
int num;
char line[ kMaxLineLength ];
char *result;
infoPtr = malloc( sizeof( struct DVDInfo ) );
if ( NULL == infoPtr ) {
printf( "Out of memory!!! Goodbye!\n" );
exit( 0 );
}
printf( "Ent...
Can someone point me to a few open source heap implementations which are not part of a huge library like GLIB.
I need one with the following features:
Single Threaded
The whole heap can be freed with a single call.
Small footprint because i need to use one heap for each list/tree widget in my GUI.
I think there should be a lot of ex...
My process runs multiple instances (processes) and multiple threads and all of them write to the same database. As soon as the request is placed, a unique req id is generated for the record to be added to the proprietary db. Here are our limitations: It cannot be more than 9 char length, needs to have hhmmss as the first 6 chars. We deci...
Assuming the FILE* is valid, consider:
char buf[128];
if(fgets(buf,sizeof buf,myFile) != NULL) {
strlen(buf) == 0; //can this ever be true ? In what cases ?
}
...
does anyone know any good GDI drawing application with source code available which is similar to mspaint?
...
I just recently finished reading Secure Coding in C and C++ by Brian Seacord, who works for CERT.
Overall, it's an excellent book and I would recommend it to any programmer who hasn't yet read it. After reading it, it occurs to me that for all the various types of security vulnerabilities (such as exploit code injection, buffer overf...
Hi All developers:
I have come across a project where it is required to draw some 2D graphics on a form under Windows and to be able to perform the following tasks:
read image formats jpg, GIF, png, with transparency
monitor mouse and keyboard input to this form
draw simple 2D shapes, eg. line, ellipse, rectangle, pixel set/clear, pol...