I have C++ code that uses some C libraries. The C libraries take C language callbacks. I wrote a callback in my C++ code and now I somehow need to report error from it (but it returns void). I wonder if I can throw an exception from a C callback that is used from C++ code?
This is very difficult for me to understand.
Thanks, Boda Cydo....
I am trying to get a version of APC that works with PHP 5.3.x
According to several online resources including wikipedia, the version of APC given as compatible with PHP 5.3.x is APC-3.1.3p1
However upon investigating the contents of the file, in the file named INSTALL
The first few lines declare:
Installation Instructions for APC
...
Is it safe to for example do:
void AddTwo(int &num)
{
num +=2;
}
void ThreadProc(lpvoid arg)
{
AddTwo((int)arg);
}
Would it be safe for this to occur if 4 threads were doing this at the same time? Thanks
...
Hello,
How can I initialize a structure if one field in the structure is itself a structure?
Thank you.
...
Hi all -
I'm looking for C or Python code to implement either of the two pseudocode functions:
function 1:
list1 = [0,1,2] #any list of single-integer elements
list2 = [0,3,4]
list3 = [0,2,4]
function1(list1, list2, list3)
>>> (0,3,2),(0,3,4),(0,4,2),(1,0,2),(1,0,4),(1,3,0),(1,3,2),(1,3,4),
(1,4,0),(1,4,2),(2,0,4),(2,3,0),(2,3,4...
#include<stdio.h>
int f();
int main()
{
f(1);
f(1,2);
f(1,2,3);
}
f(int i,int j,int k)
{
printf("%d %d %d",i,j,k);
}
it is running fine(without any error) ...can u plz explain how it executes ?
how f(1) and f(1,2) links to f(int,int,int) ?
...
In Visual C++, one can find the header file where any name (variable or type) is defined by pressing F12 on it or choosing Go to Definition. This feature is very useful, but it only shows the final location (header file) where the name is defined. Is there a way to figure out the chain of header files that lead from my source file to the...
I have written a small server
#include <stdio.h>
#include <netinet/in.h>
#include <sys/types.h>
int main()
{
int server_fd, newsock_fd, server_len, newsock_len;
struct sockaddr_in server_struct, newsock_struct;
server_fd=socket(AF_INET,SOCK_STREAM,0);
server_struct.sin_family=AF_INET;
server_struct.sin_addr.s_addr=inet_addr("127.0.0.1...
On http://groups.google.co.in/group/comp.lang.c/browse_thread/thread/bfb312ad902d94eb/74dcdcacce777679?lnk=gst&q=conditional+operator#74dcdcacce777679
There is an answer given for a question why
(A%2==0)?A=0:A=1 gives error.
The thing I don't understand that when do we use (precedence and associativty) and we
use C grammar to parse...
Here, i have a program, which takes arguments (how surprising...). I want him to have several arguments, as:
./myprogram -f filename.txt -x -o
so i want main args with "-", and these arg shall accept an other arg, in the example, a filename.
I have this structure, very simple:
int main(int argc, char *argv[])
{
printf("Program n...
Hello,
I am interested in learning how to do embedded system programming in c. However, I will need some hardware.
I am wondering is there any software that can simulate what the control board will do?
The control board is listed in the following tutorial
http://www.learn-c.com/hardware.htm
Many thanks for any advice
...
can I do something like:
typedef void (*functor)(void* param);
//machine code of function
char functionBody[] = {
0xff,0x43,0xBC,0xC0,0xDE,....
}
//cast pointer to function
functor myFunc = (functor)functionBody;
//call to functor
myFunc(param);
...
I have been given a task to covert lower case character into upper case by using macros .the problem is that i have never been introduced to macros. i just know that its something #define name size .. please can anyone guide me on this issue
...
I understand somewhat how "int a = b+abs(c)" can be translated to simple assembly instructions and then translate that to some binary blob. But how can this be run and be interacted with dynamically in memory?
-- edit --
I know C doesn't have an eval feature. But what it's compiled to does. I mean this is what makes Java like JITs, and...
Hello,
I want to define a macro which includes another header file like so:
#define MY_MACRO (text) #include "__FILE__##_inline.inl"
So that when the preprocessor parses file person.h, MY_MACRO(blahblah) expands to
#include "person.h.inline.inl"
any hints on how to do this ?
...
please help me to set directories path of C language compiler
...
hello all,
Following is my requirement.
while process A is running.
attach Process A from B with PTRACE_ATTACH.
Start a Loop
Stop Process A
read registers
Resume Process A
sleep(1)
end loop
detach A
i am facing issue with Start and Resume Process A from the loop. i tried combination of kill(pid,SIGSTOP), kill(pid,SIGCONT), PTRACE...
I read from man pages of execve that if a process(A) call execve, the already opened file descriptors are copied to the new process(B).
Two possiblities arise here :-
1) Does it mean that a new file descriptor table is created for process B, the entries to which are copied from older file descriptor table of process A
2) Or process B ...
There are many times that i get compile errors when I use char* instead of const char*. I am not sure the actual difference, the syntax and the compile mechanism.
...
Hi,
I want to read a ttf and draw a text with that font on a buffer. Even though there are libraries such as freetype, gd to do this task, I want to write my own code. Can you advice me on how to accomplish this task?
...