c

How to create an application which embeds and runs Python code without local Python installation?

Hello fellow software developers. I want to distribute a C program which is scriptable by embedding the Python interpreter. The C program uses Py_Initialize, PyImport_Import and so on to accomplish Python embedding. I'm looking for a solution where I distribute only the following components: my program executable and its libraries ...

IOKit header assert.h gone? [answered]

I want to get the hardware address of my mac's ethernet card. In all samples I saw in include on IOKit/assert.h . Which doesn't seem to exist on my system. GCC throws an error saying he doesn't know the type IOEthernetAddress. Is assert.h necessary for my task? It would be great if someone coud give me a working sample. [edit] here's my ...

Choice for Socket Server Application: C/C++ or C#

What would be the most sensible choice for building a socket server application, assuming that you had the luxury of choosing between C/C++ or Csharp, and you intend to run multiple instances of the same server on both Windows and Linux servers? ...

Determine if a day of week and time fall in a custom weekend period

I've been trying to come up with a method, that given a day of week and time of day, it will return if it falls under a custom weekend period. The weekend period is saved in 4 variables as follows: The day of week when it starts (0-6) The time of day when it starts (0-23) The day of week when it ends (0-6) The time of day when it ends...

Is there any LAME c++ wraper\simplifier (working on Linux Mac and Win from pure code)?

So I want to create simple pcm to mp3 C++ project. I want it to use LAME. I love LAME but It is realy biiig. so I need some kind of OpenSource working from pure code with pure lame code workflow simplifier. So to say I give it File with PCM and DEST file. Call something like LameSimple.ToMP3(file with PCM, File with MP3 , 44100, 16, MP...

malloc()/free() behavior differs between Debian and Redhat

I have a Linux app (written in C) that allocates large amount of memory (~60M) in small chunks through malloc() and then frees it (the app continues to run then). This memory is not returned to the OS but stays allocated to the process. Now, the interesting thing here is that this behavior happens only on RedHat Linux and clones (Fedor...

Easiest way to generate P/Invoke code?

I am an experienced .Net programer, but have not compiled a C/C++ program in my life. Now I have this C-dll, headers and documentation (3rd party, not from Win API), from which I need to call about ten methods. I was thinking of using Platform Invoke. I found these three tools that would create the code for me: PInvoker: http://www.pi...

How can I obtain the local TCP port and IP Address of my client program?

Hello! I'm prepping for a simple work project and am trying to familiarize myself with the basics of socket programming in a Unix dev environment. At this point, I have some basic server side code and client side code setup to communicate. Currently, my client code successfully connects to the server code and the server code sends it a ...

Are C files renamed to C++ are going to be compilable with C++ compilers after renaming?

C files renamed to C++ are going to be compilable with C++ compilers after renaming? So I have 25 C files and 1 C++ file I do not want to create Make files or anething like that. I want to turn all that C files into C++ so will simple renaming work or what shall I do? ...

How can I obtain the IP address of my server program?

Hello! This question is related to another question I just posted. I'm prepping for a simple work project and am trying to familiarize myself with the basics of socket programming in a Unix dev environment. At this point, I have some basic server side code and client side code setup to communicate. Currently, my client code successfully...

passing different structs to a function in c

I have different structures that need to be filled out the same way. The only difference is that they are filled based on different data. I was wondering if it's possible to pass different structures to a certain function. What I have in mind is something like: struct stu1 { char *a; int b; }; struct stu2 { char *a; i...

Binary Tree in C Insertion Error

I'm quite new to C and I'm trying to implement a Binary Tree in C which will store a number and a string and then print them off e.g. 1 : Bread 2 : WashingUpLiquid etc. The code I have so far is: #include <stdio.h> #include <stdlib.h> #define LENGTH 300 struct node { int data; char * definition; struct node *left; struct node *...

Vala vapi files documentation

Hi there, I'd like to hack on an existing GLib based C project using vala. Basically what I'm doing is, at the beginning of my build process, using valac to generate .c and .h files from my .vala files and then just compiling the generated files the way I would any .c or .h file. This is probably not the best way, but seems to be workin...

How to read STDIN into string variable until EOF in C?

Hi, im getting "Bus Error" trying to read stdin into a char* variable. I just want to read whole stuff coming over stdin and put it first into a variable, then continue working on the variable. My Code is as follows: char* content; char* c; while( scanf( "%c", c)) { strcat( content, c); } fprintf( stdout, "Size: %d", strlen( content...

Is there a function in C that does the same as raw_input in Python?

Is there a C function that does the same as raw_input in Python? #in Python:: x = raw_input("Message Here:") How can I write something like that in C? Update:: I make this, but i get an error :: #include<stdio.h> #include<string.h> #include "stdlib.h" typedef char * string; int raw_input(string msg); string s; string *d; main(){...

How to prevent SxS error when launching the application from virtual path?

I am currently working on a simple application virtualization layer by virtualizing all file/registry operations at the NtDll.dll level. But when I launch the application from the virtual path, and if the virtual path doesnt exist in the actual Host, then the application fails to launch. Here is the example If the virtual filesyste...

how to print correctly the handling thread on Windows?

Hi, Could someone please tell us on how to print correctly the handling thread in windows? Actually I tried several ways but it doesn't return the right number as in Unix-variant, as such e.g.: cout << " with thread " << pthread_self << endl; cout << " with thread " << pthread_self().p << endl; Thanks for your replies: ...

Is continuous virtual memory increase an indication of a memory leak?

Is continuous increase in virtual memory(private bytes) of process indicate memory leak...? I am using third party library. Continuous use of library leads to continuous increase of virtual memory. So its a memory leak which can leads to continuous virtual memory increase or it can be any other reason. ...

How can I use GLUT with CUDA on MACOSX?

Hi, I'm having problems compiling a CUDA program that uses GLUT on MacOsX. Here is the command line I use to compile the source: nvcc main.c -o main -Xlinker "-L/System/Library/Frameworks/OpenGL.framework/Libraries -lGL -lGLU" "-L/System/Library/Frameworks/GLUT.framework" And here is the errors I get: Undefined symbols: "_glutInitW...

choosing which main() to use in the Makefile

In a C project, I have a main() function in several files. When I compile I thus have an error "multiple declarations of main". Is it possible to choose in the Makefile which one of those main() functions should be used to compile ? (the other ones would then be ignored...) ...