I have a Linux daemon that forks a few children and monitors them for crashes (restarting as needed).
It will be great if the parent could monitor the memory usage of child processes - to detect memory leaks and restart child processes when the go beyond a certain size.
How can I do this?
...
When I compile my iPhone app, xCode gives "duplicate symbol" error for my variables in MyConstants.h
I thought if I used:
#import "MyConstants.h"
it would avoid that?
But I still have the problem.
Added info:
The error occurs during "linking".
(I'm just using xCode's "Build and Go" button.)
I also tried the (unnecessary with #im...
Hi, I read on OSDev wiki, that protected mode of x86 architecture allow you to create separate segments for code and data, while you cannot write into code section. That Windows (yes, this is the platform) loads new code into code segment, and data are created on data segment. But, if this is the case, how does program know it must switc...
Hello,
I have wrote an application that consists of two projects in a solution, each project contains only 1 .c source file. I was using Visual Studio 2010 Ultimate but due to the University only supporting 2008 I decided to create a blank solution and copy the source files into the new one.
After creating a new solution in VS2008 expr...
I recently heard this was used as an interview question. I suspect there is a very simple answer; I must be over-thinking it.
Can you write Hello World in C without
using any semi-colons? If so, how?
...
i was trying to count the number of multiples of 2, 3, and 6 respectielly from the users input file. but for some reason, my counter is not working. can any bosy hep me please.
my code:
#include <stdio.h>
int main (void)
{
int num[12];
int i;
int counttwo;
int countthree;
int countsix;
int total=0;
printf("enter 12 integer...
hi
i'm trying to run one c executable file using php exec().
When c contains a simple program like print hello. I'm using
exec('./print.out')
It's working fine. But when I need to pass a argument to my c program I'm using
exec('./arugment.out -n 1234')
It is not working. Can any body tell me how to pass arugment using exec to...
I am trying to use this code for the Porter stemming algorithm in a C++ program I've already written. I followed the instructions near the end of the file for using the code as a separate module. I created a file, stem.c, that ends after the definition and has
extern int stem(char * p, int i, int j) ...
It worked fine in Xcode but it ...
What do the last lines mean?
a=0;
b=0;
c=0;
a && b++;
c || b--;
Can you vary this question to explain with more interesting example?
...
Hi,
I'm writing a small bignum library for a homework project. I am to implement Karatsuba multiplication, but before that I would like to write a naive multiplication routine.
I'm following a guide written by Paul Zimmerman titled "Modern Computer Arithmetic" which is freely available online.
On page 4, there is a description of an a...
I don't understand why this would give me a seg fault. Any ideas?
This is the function that returns the signal to stop the program
(plus the other function that is called within this):
double bisect(double A0,double A1,double Sol[N],double tol,double c)
{
double Amid,shot;
while (A1-A0 > tol) {
Amid = 0.5*(A0+A1);
shot = ...
The exact error I am getting is
First-chance exception at 0x0096234a in chp2.exe: 0xC0000005: Access violation writing location 0x002b0000.
Windows has triggered a breakpoint in chp2.exe.
And the breakpoint stops here
for(DWORD i = 0; i < m; ++i)
{
//we are start at the top of z
float z = halfDepth - i*dx;
for(DWORD j = ...
(all are declared as ints, none are initialized to anything beforehand. I have included math.h and am compiling with -lm)
cachesize = atoi(argv[1]);
blocksize = atoi(argv[3]);
setnumber = (cachesize/blocksize);
printf("setnumber: %d\n", setnumber);
setbits = (log(setnumber))/(log(2));
printf("sbits: %d\n", setbits);
when given cachesi...
I have a 3rd party library that's written in C. It exports all of its functions to a DLL.
I have the .h file, and I'm trying to load the DLL from my C++ program.
The first thing I tried was surrounding the parts where I #include the 3rd party lib in
#ifdef __cplusplus
extern "C" {
#endif
and, at the end
#ifdef __cplusplus
} // ext...
I am trying to build Linux From Scratch, and now I am at chapter 5.4, which tells me how to build Binutils. I have binutils 2.20's source code, but when I try to build it:
time { ./binutils-2.20/configure --target=$LFS_TGT --prefix=/tools --disable-nls --disable-werror ; }
it gives me an error:
checking build system type... i686-pc-l...
I am using Visual Studio 2005 (C\C++).
I am passing a string into a function as a char array. I want to open the file passed in as a parameter and use it. I know my code works to an extent, because if I hardcode the filename as the first parameter it works perfectly.
I do notice if I look at the value as a watch, the value includes the...
Given the code below:
typedef struct {int a;} test_t;
arbitrary_t test_dosomething(test_t* test) {
if (test == NULL) {
//options:
//1. print an error and let it crash
//e.g. fprintf(stderr, "null ref at %s:%u", __FILE__, __LINE__);
//2. stop the world
//e.g. exit(1);
//3. return (...
Let's say I have a C program, and I run it from bash:
$ ./a.out 123 *
The program would output all the command line arguments,
but it will show these instead:
Argument 1: 123
Argument 2: a.out
What can I do in my program to fix this?
...
were doing some audio stuff and I keep seeing this in the Organizer > Console.
Sun May 2 20:16:48 unknown kernel[0] : i2s0: transmitter underrun (0)
Are these transmitter underruns bad? I think its just when were shutting down audio input...but could a few of these cause some issues later on?
...
I am given the following declaration:
char inbuff[500], *ptr;
int n, bufferlen;
Write a program segement to receive a message having 500 bits from the TCP socket sock and store this message in inbuff.
My answer is:
n = recv( sock, inbuff, strlen( inbuff ), 0 );
However, I am not sure why *ptr is given in the declaration.
So, I w...