Hello,
I have a problem that consist in comparing boolean expressions ( OR is +, AND is * ). To be more precise here is an example:
I have the following expression: "A+B+C" and I want to compare it with "B+A+C". Comparing it like string is not a solution - it will tell me that the expressions don't match which is of course false. Any i...
char in[100], *temp[10],var[10][10];
int i, n = 0,
double val[10];
var[0][]="ANS";
I want to assign a string to var[0][0,1,2] which is 'ANS', but does not work and i cannot figure where i am wrong about this
...
Hello everyone:
I'm now trapped by a performance optimization lab in the book "Computer System from a Programmer's Perspective" described as following:
In a N*N matrix M, where N is multiple of 32, the rotate operation can be represented as:
Transpose: interchange elements M(i,j) and M(j,i)
Exchange rows: Row i is exchanged w...
I think the title says it all, however, I'll expand a bit.
Is there a difference between having the following code at the begining of program 'progX'
if(daemon(0, 0) == -1)
{
printf("daemon error: %s", strerror(errno));
}
or running 'progX' via the command: progX & 2>/dev/null 1>/dev/null 0>/dev/null
...
What is the C equivalent of C++
delete[] (char *) foo->bar;
Edit: I'm converting some C++ code to ANSI C. And it had:
typedef struct keyvalue
{
char *key;
void *value;
struct keyvalue *next;
} keyvalue_rec;
// ...
for (
ptr = this->_properties->next, last = this->_properties;
ptr!=NULL;
last = ptr, ptr = ptr->ne...
How can i write an if statement which tells to the program if the pointer is assigned or not?
WRONG example
if (*badpdr[0]==0);
??
...
I have external app reading files, I want to hook that to get event in my app. But I cannot find a sources hooking ReadFile (or something else that can help me achieve that). Any ideas how to do that? It must be done in User-Mode. I was thinking for something similar to Process Monitor. I wonder how it does it..
...
Possible Duplicate:
Examples of good gotos in C or C++
What uses of the goto statement do you consider acceptable? I am discussing some coding guidelines for C embedded work, and wondering if there are cases where goto is the cleanest way to do things.
...
Hi,
I am working on some C code.
There is a function like this;
void Get(double x_la[],
double y_la[],
double z_la[])
in the function body, for some other reasons I create;
double (*la)[3];
As far as I understood, x_la, y_la and z_la are pointers of the type double.
I need to "connect" the pointers involved in "la" wiht the p...
My initial UDP socket is binded to 127.0.0.1:9898.
The first time that I get notified of incoming data by epoll/kqueue, I do recvfrom() and I fill a struct sockaddr called peer_name that contain the peer informations (ip:port).
Then I create a new UPD socket using socket(),
then I bind() this newly created socket to the same ip:port (...
I am really new programming in C. How can I do the same in C, maybe in a more simple way than the one I do in Java?
Each line of the input has two integers: X and Y separated by a space.
12 1
12 3
23 4
9 3
InputStreamReader in = new InputStreamReader(System.in);
BufferedReader buf = new BufferedReader(in);
int n;
int k;
double sol...
I have a struct with an array of 100 int (b) and a variable of type int (a)
I have a function that checks if the value of "a" is in the array and i have generated the array elements and the variable with random values.
but it doesn't work
can someone help me fix it?
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
typedef str...
In an embedded C app, I have a large image that I'd like to rotate by 90 degrees. Currently I use the well-known simple algorithm to do this. However, this algorithm requires me to make another copy of the image. I'd like to avoid allocating memory for a copy, I'd rather rotate it in-place. Since the image isn't square, this is tricky...
Hey all :)
I have a problem my src pointer of memcpy is pointing wrong.
unsigned char* lpBuffer is a buffer that contains my bytes, i checked with olly.
The code:
IMAGE_DOS_HEADER iDOSh;
memcpy(&iDOSh,lpBuffer,sizeof(iDOSh));
The problem is that lpBuffer points wrong, output from debugger is
dest = 002859E8 RIGHT
src = 000001D8 ...
I'm trying to do a couple of things at once. I'm trying to do one major thing: redirect the application output that is displayed in the Qt Creator console to a textEdit that I have on my GUI. However, the class that I need to do this in is written in C and all of its related headers are in C as well. Is there a way that I can redirec...
Modern keyboards have special multimedia keys, e.g. 'Pause/Play' or 'Open Web Browser'. Is it possible to write a program that "presses" these keys?
I would prefer solution in C, but I would accept a language agnostic solution, too.
...
How can I make GNU Make use a different compiler without manually editing the makefile?
...
How to create a script to :
compare two trees,
in c/c++ in a non recursive mode?
also,
How to create a script in c/c++ to verify if a tree is binary, in a non recursive mode?
thanks in advance.
...
int epoll_wait(int epfd, struct epoll_event *events, int maxevents, int timeout);
I'm a little confused about the maxevents parameter. Let's say I want to write a server that can handle up to 10k connections. Would I define maxevents as 10000 then, or should it be be lower for some reason?
...
I have this code:
#include <stdio.h>
#include <wchar.h>
int main()
{
wchar_t *foo = L"ðħ";
wprintf(L"[%ls]\n", foo); return 0;
}
And when I compile it, it gives me the implicit declaration of function ‘wprintf’ warning. I know that I should link the wchar library during compilation, but how do I do that?
...