I'm not real hip on exactly what role(s) today's proxy servers can play and I'm learning so go easy on me :-) I have a client/server system I have written using a homegrown protocol and need to enhance the client side to negotiate its way out of a proxy environment.
I have an existing client and server system written in C and C++ for t...
Hey guys
Basically I'm working on a model of an automated vacuum cleaner. I currently have made software simulation of the same. How do I figure out which SOC or SDK board to use for the hardware implementation? My code is mostly written in C. Will this be compatible with the sdk provided by board manufacturers? How do i know what clock...
I am trying to read file with 30 rows and 5 columns with separator of "tab". Each time I get only part of the rows.
In the windows environment it's working good. Any idea why in unix it is not working?
while (fscanf(FFMapFile, "%s\t%s\t%s\t%s\t%s\t", fnfMap[i].COS_ID, fnfMap[i].FF_First_Act, fnfMap[i].FF_Next_Act, nfMap[i].Free_FF_allo...
At some places in my code, I print debug messages like this:
int ret = getLinkSpeed(device.getSysName(), linkSpeed);
if (ret < 0)
{
logDebug("Failed to obtain port speed for this device. Error: " + std::string(strerror(errno)));
}
From the documentation it is not entirely clear if strerror will return 0 under certain conditions (w...
What am I doing wrong here, I can't get the result of this division:
aspectRatio = backingWidth / backingHeight;
I've thought I might try casting to (GLfloat) but that didn't do anything. As I step through the code I see that aspectRatio is 0 after the operation, while backingWidth is clearly 768 and backingHeight is 1029.
Here are ...
Is it possible to write a macro that has a type and a value as its input parameters (MACRO(type,value)), and returns a valid pointer to a location that holds the submitted value.
This macro should perform like the following function, but in a more generic manner:
int *val_to_ptr(int val){
int *r = NULL;
r = nm_malloc(sizeof(*r)...
I am frustrated. I have a simple doubt ..
I compile a simple program with gcc and if I see the section header using objdump, it does not show the section ".symtab". for the same a.out file, readelf shows the section. see the below snip -
[25] .symtab SYMTAB 00000000 000ca4 000480 10 26 2c 4
[26] .strta...
Hello,
I have simple C/gtk+ application. I have function in this app which load image in gtkimageview widget:
gboolean
main_win_open( MainWin* mw, const char* file_path)
{
...
//loading and displaing image in gtkimageview
...
}
The loading image is work, but i need to run this function in another thread then main gui fo...
Hello once more dear internet,
I writing a small program that among other things, writes a log file of commands received.
to do that, I want to use a thread that all it should do is just attempt to read from a pipe, while the main thread will write into that pipe whenever it should.
Since i don't know the length of each string command, ...
Hi, I'm trying to initialise a structure which ends with an array[0] (here, char iedata[0]) for the actual packet payload. If I try to initialise it inline, like this:
struct some_packet pkt = {
.elem1 = blah, .elem2 = bleh,
.iedata = {
1, 2, 3, 4
}
};
I get a warning from gcc:
warning: (near initialization for ‘pkt.ie...
I want to create a GUI driven application for a micro-controller (Atmel XMEGA) that is connected to a 128x64 dots graphics LCD (EA DOGL128-6) and 4 buttons for navigation.
Controlling the display itself (e.g. drawing pixels and characters) is no problem but in order to prevent me from reinventing the wheel I was googling for a GUI-Libra...
where is wrong? how to assign value to eip to change the location of running in program?
Please help !!!!
error: cannot convert ‘mcontext_t*’ to ‘sigcontext*’ in assignment
struct ucontext {
unsigned long uc_flags;
struct ucontext *uc_link;
stack_t uc_stack;
struct sigcontext uc_mcontext;
sigset_t u...
I am working with my first straight C project, and it has been a while since I worked on C++ for that matter. So the whole memory management is a bit fuzzy.
I have a function that I created that will validate some input. In the simple sample below, it just ignores spaces:
int validate_input(const char *input_line, char** out_value){
...
Hi,
I am trying to do something quite easy: fill an char** with arguments I want to use in a execvp call in C.
This is how I am doing:
if(argc >=1)
{
*nargv = "--action";
while(argc--)
{
printf("nargv1 => %s \t argv1 => %s \n", *nargv, *argv);
*++nargv = *argv++;
printf("nargv2 =>...
I'm making a particle system for my game, which basically is smoke coming out from rockets in my game. All particles are in a ccArray called smoke.
ccArray *smoke = ccArrayNew(0);
I have a class called Smoke, which is a subclass of CCSprite, with the addition of an ivar called __opacity.
When I add a new smoke to the ccArray I do lik...
If there is an array of ar[5000] then how could I find where element [5][5][4] would be if this was a 3 dimensional array? Thanks
I'm mapping pixels:
imagine a bimap of [768 * 1024 * 4]
where would pixel [5][5][4] be?
I want to make this:
static GLubyte checkImage[checkImageHeight][checkImageWidth][4];
static GLuint texName;
bool itt...
Hello,
gcc 4.4.4 c89
I was just experimenting with a int array. And something just came to my mind. Can I nul terminate it. For example, I am using a 0 to nul terminate. However, 0 could well be a valid value in this array.
The code below will terminate after the 5. Even though I mean 0 to be a valid number. However, I could specify ...
Hi,
in C++, using printf I want to print a sequence of number, so I get, from a "for" loop;
1
2
...
9
10
11
and I create files from those numbers. But when I list them using "ls" I get
10
11
1
2
..
so instead of trying to solve the problem using bash, I wonder how could I print;
0001
0002
...
0009
0010
0011
and so on
Thanks
...
What is the clean way to do that in C?
wchar_t* ltostr(long value) {
int size = string_size_of_long(value);
wchar_t *wchar_copy = malloc(value * sizeof(wchar_t));
swprintf(wchar_copy, size, L"%li", self);
return wchar_copy;
}
The solutions I came up so far are all rather ugly, especially allocate_properly_size_whar_t u...
Possible Duplicate:
Generating Random Numbers in Objective-C
How do I generate a random number which is within a range?
...