I'm trying to install libxml2 on my Mac (OS 10.6.4). I'm actually trying to just run a Scrapy script in Python, which has required me to install Twisted, Zope, and now libxml2. I've downloaded the latest version (2.7.7, from xmlsoft.org) and tried following these instructions here. To summarize, I tried this command (in the python sub...
Is there a clever/efficient algorithm for determining the hypotenuse of an angle (i.e. sqrt(a^2 + b^2)), using fixed point math on an embedded processor without hardware multiply?
...
I would like to know what are the common memory management issues associated with C and C++. How can we debug these errors.
Here are few i know
1)uninitialized variable use
2)delete a pointer two times
3)writing array out of bounds
4)failing to deallocate memory
5)race conditions
1) malloc passed back a NULL pointer. You need to...
I have a C file running on Linux. It prints some lines in red (failures) and some in green (passes). As you might expect, it uses escape codes in the printf statements as follows:
#define BLACK "\033[22;30m"
#define GREEN "\033[22;31m"
printf(GREEN "this will show up green" BLACK "\n");
If the BLACK at the end wasn't there, the ter...
Given a char, how to convert this char to a two digit char, which is the hex value of the binary presentation?
For example, given a char, it has a binary presentation, which is one byte, for example, 01010100, which is 0x54.....I need the char array of 54.
...
I am calling a function which will branch and execute the code of another process for me. There are multiple processes, labeled B, C, and D. I have almost identical code for creating the different processes. For some bizarre reason that I can't uncover, one of the process creation functions causes a segmentation fault. They look identica...
Well, initial reason I ask this question is I need from time to time learning materials for struggling C / C++ developer who is in general competent but needs to improve some aspect directly related to embedded system software development (telecom mainly). And I found I have not so many useful things to recommend.
Could community help w...
i have never done embedded (i dont know if thats what you call this) programming and know nothing about it. my question:
is it possible to have two devices sharing a wireless connection (no internet, just between themselves, perhaps bluetooth, but i dont know what ever is best) ?
is it possible to have one editing a file and the other ...
I'm a bit confused about how to implement my state machine.
I already know it's hierarchical since some states share the same action.
I determine what I need to do by these parameters:
Class (Values are: Base, Derived, Specific)
OpCode
Parameter 1 - optional
Parameter 2 - optional
My hierarchy is determined by the Class and the OpC...
Hello,
I've tried looking at a bunch of forums, and despite a lot of tweaking and reanalyzing, I'm a little stuck.
I'm trying to return a jdoubleArray via the JNI from my C++ code, but the values I seem to be entering don't seem to be carrying through. Here's the code.
jdoubleArray ret = env->NewDoubleArray(2);
jdouble* rotatio...
Hi, I'm having trouble creating a port in Unix. This code keeps returning "Error creating socket (3)", which makes no sense whatsoever, since sockfd must be smaller than 0 to print the error line.
server.c:
int main (int argc, char **argv)
{
int sockfd;
struct sockaddr_in server_sockaddr;
char buff[TRANSFER_BUFFER_LEN];
/* che...
#include <stdio.h>
#define MAX 5
int stk[MAX];
int top=-1;
main()
{
char ch;
void push();
void pop();
void display();
do
{
printf("1. Push\n");
printf("2. Pop\n");
printf("3. Display\n");
ch=getchar();
if(ch=='1')
push();
i...
I understand that in order to return a string from a function I have to return a pointer. What I don't understand is why a char array is treated somewhat different from, say, integer, and gets destroyed when you exit the function. That's probably because I come from a high-level languages world, but this seems to be equally valid to me:
...
I intend to store strings into an array of pointers to strings and then display them as follows :
char *directions[3];
for(i=0;i<3;i++)
scanf("%s",directions[i]);
for(i=0;i<3;i++)
printf("%s",directions[i]);
but when i run this code ,it gives me segmetation fault ,could someone please correct me?
...
volatile static int i;
and
static volatile int i;
what is the difference between the two? How does the compiler see this?
...
I am working on an opengl application and implementing a bezier surface in the iPhone and I am getting this:
Data Formatters temporarily unavailable, will re-try after a
'continue'. (Not safe to call dlopen
at this time.)
No memory available to program now: unsafe to call malloc
and sometimes I get malloc_error_break free...
Hi Experts,
I see that for the following code produces the result as below, any idea on why is the output like this:-
#include < stdio.h >
#include < math.h >
int main(){
int i=0;
for(i=0; i<10; i++){
printf("%d\t\t\t%d\t\t\t", i, (int)pow(10, i));
printf("%f\n", pow(10, i));
}
return 0;
}
/*
Outputs:-
0 ...
As I know C enum is unsigned integer, but this may vary by implementation.
What type should I use for the enum in binary representation?
*PS
'binary representation' means byte-array. I want to serialize enum values to socket to inter-operate with other programs.
...
I posted other question: http://stackoverflow.com/questions/3509470/what-type-should-i-use-for-binary-representation-of-c-enum, and by the answer, I have to know my compiler's enum data-type.
What's the data-type of C enum on Clang compiler?
...
How can I convert an ARGB integer to the corresponding ARGB tuple (A,R,G,B)?
I receive some XML where a color tag is given with some integer value (e.g -16777216). I need to draw a rectangle filled with that color. But I am unable to retrieve values of the A,R,G,B components from the integer value.
...