I'm writing a C application which is run across a compute cluster (using condor). I've tried many methods to reveal the offending code but to no avail.
Clues:
On Average when I run the code on 15 machines for 2 days, I get two or three segfaults (signal 11).
When I run the code locally I do not get a segfault. I ran it for nearly 3 we...
I have a function
void add_car(char *car) {
park.buffer[park.size] = car;
park.size ++;
}
car is a string like "XYZ". Atm, It seems to assign the carpark buffer array element to an address. Thus if I fill the array with 10 cars, I get back 10 cars, but each of them is the latest one, since the address of car was overwritten. H...
I read that pointers passed by malloc() & calloc() get allocated memory dynamically from the heap.
char *Name="Ann";
In this case, is the static string {'A','n','n','\0'} also stored in the heap?
Can I modify the string using the pointer?
...
I've been searching for a Linux sampling profiler, and callgrind has come the closest to showing useful results. However the overhead is estimated at 20--100x slower than normal. Additionally, I'm only interested in time spent per function (with particular emphasis on blocking calls such as read() and write(), which no other profiler wil...
I have written a code that maps to a shared memory location,so that the first program opens a shared memory block and stores some data in it.And the second program reads the shared data.
Whats the difference between the two command lines:
1.
if(argc<2)
{
printf("USAGE:%s text-to-share\n",argv[0]);
}
This code gives me a Segm...
Hi guys,
I have question regarding the CreateWindowEx function. I have 2 windows, a main one and a popup one. I want a popup window to hide everywhere. It is currently not displayed in taskbar and it is not even visible in alt+tab menu. However it is visible on "Applications" tab in task manager. What flags do I need to use in CreateWin...
Given an array of pointers to ordinary C NUL-terminated (and typically very long) strings, how can we best find the smallest and the largest strings?
...
Hello, I am having a confusing issue -- for me at least, this may be very simple and I am missing something. I am trying to initialize a 2D array of variable size, The array is a part of a struct. I am having no issue allocating memory for the array but when I try to assign characters to the array, or print them I receive unexpected resu...
I need to parse strings of four hex characters to an integer. The characters appear inside a longer string, and there are no separators - I just know the offset they can be found in. The hex characters are case insensitive. Example with offset 3:
"foo10a4bar" -> 4260
I'm looking for a snippet that is
Short (too much code always crea...
I have to write a C parser for online blogs and different word manipulation features.
I know how to parse / tokenise stings in C, but how would you on execution download the pages content to a local /tmp directory as an HTML file so I can save the information (the blogs) into a string using I/O?
Or, just grab the block of text directly...
When to use Single quote and double quote in C programming ?
...
Hi,
I'm looking for a delphi component or ActiveX which can access to GSM devices through serial port.
I need to send and receive binary data sms (8-bit coding).
...
We have a console application (currently .NET) that sends out mail in bulk to people that have subscribed to a mailing list. We are re-implementing this application because of limitations that it currently has.
One of the features it must have, is that it can resume after an unexpected interrupt of its operation. This means that every t...
Hi again,
In my winAPI project done in C++ (no MFC, no .net...), I am creating comboboxes in place of edit controls, because of the nice blue border. In many windows forms and dialogues, edit controls also have this look. There are two problems:
This doesn't seem like like "proper" way to make an edit control look that way.
What if I ...
hi guys i am new so i am sure you will help
i have some trouble with skip list here is code
#include <stdio.h>
#include<stdlib.h>
#include<time.h>
#include <string.h>
#define P 0.5
#define MAX_LEVEL 6
struct sn{
int value;
struct sn **forward;
};
typedef struct sn skipnode;
typedef struct{
skipnode *...
Realloc is used to reallocate the memory dynamically
Suppose I have allocated 7 bytes using the malloc function and
now I want to extend it to 30 bytes.
What will happen in the background
if there is no sequential (continously in a single row) space of 30 bytes in the memory?
Is there any error or will memory be allocated in parts???
...
Hi all,
I am generating x86-64 code at runtime in a C program on a linux system (centos 5.4 to be exact).
I generate my bytecodes into a global array as shown below
char program[1024 * 1024] __attribute__((aligned (16)));
and then call into it via a function pointer.
My issue is, when I compile the program like this
gcc -std=gnu99...
Possible Duplicate:
static vs extern C
What is the difference between static and extern in C?
...
Whenever I resize my controls in my window, in resopnse to a WM_SIZE message, they resize and redraw themselves fine. But my combobox control (a dropdown list) disappears whenever I give it a resize message, until I hover over it to bring it back.
There are two possibilities, either it is not redrawing when I resize it, or it is being h...
I'm implementing a program which loads pure code from a file and calls the first instruction. No matter what I do, I get a Segmentation fault when my call instruction is executed. What do I do wrong?
char code[65536];
...
__asm__("movl code, %eax");
__asm__("call *%eax");
...