Hi
I'm building C++ app with CMake. But it uses some source files in C. Here is simplified structure:
trunk/CMakeLists.txt:
project(myapp)
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -g -Wall")
add_subdirectory (src myapp)
trunk/src/main.cpp:
#include "smth/f.h"
int main() { f(); }
trunk/src/CMakeLists.txt:
add_subdirectory (smth)
lin...
Hi
Is there any way to differentiate the child processes created by different fork() functions within a program.
global variable i;
SIGCHLD handler function()
{
i--;
}
handle()
{
fork() --> FORK2
}
main()
{
while(1)
{
if(i<5)
{
i++;
if( (fpid=fork())==0) --> FORK1
handle()
else (f...
Hi,
Some friends and I wanted to develop a game. Any language will do. I've been programming in C for years, but never wrote a game before. One of us knows SDL a little bit. It would also be a nice excuse to learn Python+pygame.
We wish our game to be 'standalone'. By standalone, I mean most users (at least Linux, Mac and Windows) will...
Is there anyway from a C prog to find whether the OS is currently running in 32bit or 64bit mode. I am using a simple program as below
int main(void){
switch(sizeof(void*)){
case 4: printf("32\n");
break;
case 8: printf("64\n");
break;
}
}
Is this a correct approach ?
Would this code work in al...
I'd like to add video conversion capabilities to a program I'm writing. FFmpeg's command line interface for doing this is simply ffmpeg -i InputFile OutputFile, but is there a way to make use of it as a library, so I can do something like ffmpeg_convert(InputFile, OutputFile)?
I'm hoping I won't have to use libavcodec directly, as I ima...
consider the code
#include<stdio.h>
int main(void)
{
char* a;
scanf("%s",a);//&a and &a[0] give same results-crashes
printf("%s",a);
return 0;
}
why does this code results in crashing?whereas this code using character array works fine?
#include<stdio.h>
int main(void)
{
char a[100];
scanf("%s",&a[0]);//works fine
...
hi i want to use google-translate as part of a C code i am writing
i understand that google-translate is use with java-script
my question is how i get it work as part of my C code?
how i make a connection from my C code to the google site?
...
I'm taking a class in computer security and there is an extra credit assignment to insert executable code into a buffer overflow. I have the c source code for the target program I'm trying to manipulate, and I've gotten to the point where I can successfully overwrite the eip for the current function stack frame. However, I always get a S...
I know there are a few similar questions, but I don't think they really have the same requirements as mine.
Our DLL is compiled with Visual Studio 2005 and must link with a specific version of the CRT, due to installation constraints. This is absolute, recompiling it with the latest version is not a solution.
We recently updated our Bo...
Is there a drop-in replacement to glibc's libm (and headers?) for x86_64-linux that is faster?
...
I am always confused about static variables, and the way memory allocation happens for them.
For example:
int a = 1;
const int b = 2;
static const int c = 3;
int foo(int &arg){
arg++;
return arg;
}
How is the memory allocated for a,b and c?
What is the difference (in terms of memory) if I call foo(a), foo(b) and foo(c)?
...
I'm taking a programming languages course and we're talking about the "extern C" declaration.
How does this declaration work at a deeper level other than "it interfaces C and C++"? How does this affect the bindings that take place in the program as well?
...
My console has transparency enabled, when I run other ncurses apps, I see the the background stays transparent. I'm trying to make my app keep the transparency and not apply a dark black opaque background.
This is what I'm doing so far
start_color();
init_pair(1, COLOR_GREEN, COLOR_BLACK);
attron(COLOR_PAIR(1));
mvprintw(10,10, "Hello...
I've been working on this assignment, where I need to read in "records" and write them to a file, and then have the ability to read/find them later. On each run of the program, the user can decide to write a new record, or read an old record (either by Name or #)
The file is binary, here is its definition:
typedef struct{
cha...
If 2 or more threads are waiting on an event, does SetEvent unblock one or all of them(Or some of them) ?
...
Dynamic integer will be any number from 0 to 150.
i.e. - number returns 41, need to return 50. If number is 10 need to return 10. Number is 1 need to return 10.
Was thinking I could use the ceiling function if I modify the integer as a decimal...? then use ceiling function, and put back to decimal?
Only thing is would also have to kn...
I would like to acquire the address of the vsyscall page for my own uses. I only have two ideas here: alter the compiler to store this information in some known location after it is given to __start, or read /proc/[pid]/maps. I really don't want to read /proc/ as that is slow and shouldn't be necessary. I also don't want to make compi...
Say you have 2 share libraries, lib1.so and lib2.so, that both have libcommon.a statically linked into them. Would the compiler complain about ambiguous symbol reference if you were to dynamically link both lib1.so and lib2.so? Or would be the compiler be smart enough to know libcommon symbols are shared between lib1 and lib2 and allow y...
Hello, maybe it's not so proper to ask this question here... anyway, I'm trying to use the gmp library for the implementation of DH, but the problem here I got is:
Once, when I was doing the tests to observe the output, although big values of prime and the private keys were selected:
p was about more than 300 digits long in decimal
a...
What is the best way to represent the following data for subsequent parallel computations:
A set of quadruples (approximately 20,000,000) of integers that need to be acessible by the first three elements of a quadruple as indexes?
The computation is supposed to be done with MPI in C/C++.
UPD: I should also emphasize that I have two si...