c

C: How to find the length of an integer

Hello, I would like to know how I can find the length of an integer in C. For instance: 1 => 1 25 => 2 12512 => 5 0 => 1 etc. How can I do this in C? ...

c++ / c confusion

Im trying to make a small app in c++ that saves midifiles with this library. http://musicnote.sourceforge.net/docs/html/index.html The sample code that is given on the homepage looks like this. #include "MusicNoteLib.h" void main() { MusicNoteLib::Player player; // Create the Player Object player.Play("C D E F ...

How can I see the C/C++ #include graph easily?

I'm looking for a tool (preferably, a Visual Studio plugin) that would display all files included by a given file and show all files included by those files and so on. ...

status failed for LdrLoadDll

hello all,I'am trying to work-out the LdrLoadDll function and am having no luck with that..i also googled for some examples there is no much documentation or correct example about this.I know what it exactly does..Please check the code below. //declaration function pointer for LdrLoadDll typedef NTSTATUS (_stdcall*fp_LdrLoadDll)( IN PW...

Help with Arduino and Analog Min Max settings

Hey there, I have the following code: sVal = analogRead(potPin); // read the value from the sensor valMin = min(sVal, 1); valMax = max(sVal, 128); constrain(sVal,valMin,valMax); itoa(sVal, res, 10); println(res); println(" "); delay(150); clearScreen(); Now for some reason, the output on the gLCD screen is almost...

libssh2 channel SSL BIO usage

Hi, I'm writing a small ftp project for my own amusement which is suppose to be able to do 4 things: connect directly to a ftp connect directly to a ftp with SSL (wrapper) connect through ssh tunnel to a ftp connect through ssh tunnel to a ftp with SSL. I'm writing my program in plain C (unix, not that it matters in this case) using...

Open source soft modem that runs on Linux?

Can anyone recommend an open source soft modem (a software only emulation of a modem card), that runs on Linux? Preferably, this will be implemented in C/C++ ...

How to use float ** from C in Python?

Hi, after having no success with my question on How to use float ** in Python with Swig?, I started thinking that swig might not be the weapon of choice. I need bindings for some c functions. One of these functions takes a float**. What would you recomend? Ctypes? Interface file: extern int read_data(const char *file,int *n_,int *m_,f...

Help with understanding K&R exercises

Hi, I am reading the book by kerninghan Ritchie Edition 2. It contains a code function on getch(), ungetch(), getop(), etc. I am not able to understand the stuff and I feel that it is bit incomplete also. Therefore, I am posting the question here. Not able to understand... what getch(), ungetch() functions are doing. Please give few exa...

Play a beep in C, MacOS

How can my program play a beep? Also Is it possible to play a sound with frequency and duration? ...

Uptime under linux in C

Hi, How can I retrieve uptime under linux using C? (without using popen and/or /proc) Thanks ...

An algo for generating code callgraphs

I am working on a project which requires generating some metrices of a code (it can be C/C++/Java/Python). One of the metrices can be that I create a callgraph after parsing the code entered (the programs are expected to be small - probably under 1000L). As of now, I am looking for a way to create a program (it can be C/Python) which ca...

late binding in C

How can late binding can be achieved in c language? can anybody please provide an example. i think it can be achieved using dlopen and dlsym but i am not sure about it.please correct me if i am wrong! ...

Locking mechanisms for shared-memory consistency

Hi all, I'm developing a mechanism for interchanging data between two or more processes using shared memory on linux. The problem is some level of concurrency control is required to maintain data integrity on the shared memory itself, and as I'm specting that sometime or another my process could be killed/crash, common lock mechanisms d...

Is stack address shared by Heap addresses ??

I read On most operating systems, the addresses in memory starts from highest to lowest. So I am wondering if the heap, stack, and global memory all fall under the same ordering..? If I created... pointerType* pointer = new pointerType //creates memory address 0xffffff And then created a local varible on the stack localObject objec...

External Delaration for An Array?

I have an array defined in a file and in another I have to use it, for e.g- /* a.c - defines an array */ int a[] = {1,2,3,4,5,6,7,8,9}; /* b.c - declare and use it. */ #define COUNT ((sizeof a)/(sizeof int)) extern int a[]; //size of array . . . int i; for(i=0; i<COUNT; i++) printf("%d", a[i]); . . . Now when I try to compil...

sizeof(Structure) Confusion

In the following piece of code, #include<stdio.h> typedef struct { int bit1:1; int bit3:4; int bit4:4; } node; int main(){ node n,n1,n2,ff[10]; printf("%d\n",sizeof(node)); return 0; } How do I predict the size of the structure? ...

Remote Desktop Project in C

I want to make project for my final year in college. So someone suggested me to make Remote Desktop in C. Now I know basic socket functions for windows in C i.e. I know how to make echo server in C. But I don't know what to do next. I searched on internet but couldn't find something informative. Could someone suggest me how to approach f...

I'm having trouble linking the GLEW library to my Xcode Project

Hi Folks, I'm currently trying to follow the OpenGL intro guide here. I've pulled the finished project straight from the git repo on the site into a new Xcode project, but upon trying to build and run I get a "GL/glew.h: No such file or directory". I've downloaded glew from the site, and run "make" and "make install". I can see 3 libGL...

ANSI C graphics extension

Hello, I have to make a project for the Windows OS in strics ANSI C (so im not allowed to use C++, C# or Objective-C). And I'm wondering if it is possible to use any kind of graphics. And if it's possible, how can I? Are there any open source frameworks for strict ANSI C that allow me to use GUI programming? Thanks in advance, Marnix ...