c

arrange strings in alphabetic order

/* write a program to sort names entered in an array in ascending order */ When i enter the names into the array the program halts .Anyone knows why? #include<stdio.h> #include<string.h> void main(void) { /* write a program to sort names entered in an array in ascending order */ int in,out,i,x; char temp[30],string2d[5][30]; ...

Call C/C++ code from a Fortran 77 code

Hi! I'm trying to make a Fortran 77 wrapper for C++ code. I have not found information about it. The idea is to use from functions from a lib that is written in C++ in a Fortran 77 progran. Does anyone know how to do it? Thanks! ...

Read from excel file in C

Hi I want to read from an excel file in C. The excel 2007 file contains about 6000 rows and 2 columns. I want to store the contents in a 2-D array in C. If there exists a C library or any other method then please let me know. Thanks. ...

[Solved] How to change Keyboard Layout (a X11 API solution)

I want to change keyboard layout in Linux by programming, What X11's API function does this? ...

Alternative to GLUTesselator?

I was wondering if there was a library or another way to produce multi contour polygons in OpenGL. I did code profiling and the GLUTesselator is killing my loop. Thanks ...

Problem to compile a C-program by GCC in the latest Cygwin due to tgmath.h and complex.h

I have successfully compiled a C-program with GCC in Mac OS X and Linux, but have got the following error message in Cygwin 1.7.5: /usr/lib/gcc/i686-pc-cygwin/4.3.4/include/tgmath.h:38:21: error: complex.h: No such file or directory I have noticed that several guys reported that tgmath.h has problems in Cygwin. However, due to the la...

Capture video from camera in Mac OS X

How I can filter video stream from camera in MacOS X. I write quicktime sequence grabber channel component, but it`s work only if app used SG API. If app used QTKit Capture the component is not worked. Somebody know how I can implement it? ...

how to read output of system('ls') ?

I am doing some file IO with c code. I have a particular pattern in my file. I can verify this by a shell command cat abc.txt | grep abc | wc -l. When I execute the same command using System(), it give proper output, but I have no clue how can I get its output into a variable and compare it in my c code itself. I tried looking into man ...

allocating array of chars and printing first entry

when i run this i get segv on printf, what am i doing wrong? int main() { char **bla; int size =10; int i; bla = calloc(size*size,sizeof(char *)); for(i=0;i<size;i++) { *bla = calloc(10,sizeof(char)); strncpy(*bla,"aaaaa",size); bla++; } ...

question about leading zeros

Here is code which returns number of leading zeros from Hacker's Delight book: #include <iostream> using namespace std; int nlz(unsigned x) { int n; if (x == 0) return(32); n = 1; if ((x >> 16) == 0) {n = n +16; x = x <<16;} if ((x >> 24) == 0) {n = n + 8; x = x << 8;} if ((x >> 28) == 0) {n = n + 4; x = x << 4;} if ((x >> 30) == 0) {...

question about ntz

Possible Duplicate: question about leading zeros As in stackoverflow.com/questions/3232534/question-about-leading-zeros. Number of trailing zeros, binary search from Hacker's Delight: #include <iostream> using namespace std; int ntz(unsigned x){ int n; if ( x==0) return 32; n=1; if ((x & 0x0000FFFF))==0) {n=n+16; x=...

Linking with multiple versions of a library

Hi, I have an application that statically links with version X of a library, libfoo, from thirdparty vendor, VENDOR1. It also links with a dynamic (shared) library, libbar, from a different thirdparty vendor, VENDOR2, that statically links version Y of libfoo from VENDOR1. So libbar.so contains version Y of libfoo.a and my executable co...

Does valgrind track memory initialization through drivers?

valgrind is reporting uninitialized memory errors from code like this: unsigned char buf[100]; struct driver_command cmd; cmd.len = sizeof(buf); cmd.buf = buf; ioctl(my_driver_fd, READ, &cmd); for(i = 0; i < sizeof(buf); i++) { foo(buf[i]); /* <<--- uninit use error from valgrind */ } If I memset() the buf before the driver call,...

Is there a way to do this?

Here is my issue. I have a std::vector<POINTFLOAT> Which stores verticies. The issue is that Vertex buffer objects take in a pointer to an array of float. Therein lies my problem. I cannot give it an array of pointfloat. Is there a way that I could instead push pointers to the individual components of each vertex without pushing in copie...

In C is it faster to use the standard library or write your own function?

For example, in <ctype.h> there are functions like isalpha(). I want to know if writing an isalpha function on my own is faster than calling isalpha? Thanks for all your instant replies! just want to make clearer to my question: so even for the isalpha function? because you can simply pass a character and check if the character is b...

Read multiples lines from file to a string in C

Hello, How can I read multiple lines from a text file (variable width) and store all of them in a C "string"? EDIT: I guess I'll be fget'ing the strings and storing them in one flexible buffer (via realloc) :) Also, this is not homework even though it apparently seems so (programming is just a hobby for me). I was just asking out of cu...

How do I write a program which can control a device driver?

I've got a laser profiling system; the included software has a few bugs and missing features that I'd like to correct. I have the source code for this software which compiles but subsequently will not run. The device driver for the hardware is already installed (Windows 7 is the platform, though XP is a likely target as well); I'd like...

on C part of C# project: Can we mix raw C and C# code (VS10)

I have a C# VS10 project. I want its part to be pure C. So I will have pure C library and A C# file that will have part with C code calling that pure Lib. So I'll have C part of code - not precompiled DLL but C code and C# code files. So is it possible to have inside one C# file C code like we have C code inside C++ code? like Inline C...

Has any one compiled lib x264 using CLI backend for gcc compiler?

Has any one compiled lib x264 using CLI backend for gcc compiler? (Compiled x264 into .net dll) ...

Read file in array line by line

Can you set any index of array as starting index i.e where to read from file? I was afraid if the buffer might get corrupted in the process. #include <stdio.h> int main() { FILE *f = fopen("C:\\dummy.txt", "rt"); char lines[30]; //large enough array depending on file size fpos_t index = 0; while(fgets(&lines[index], ...