c

compiling in visual studio 2005 and visual C++ 6.0

Hello, What is the difference of creating a simple C DLL between using visual studio 2005 and visual C++. I saw that when creating it under studio also a manifest was created and I had some problems regarding deployment in another machine because of using side-by-side folder (when calling that dll form a C# application" How does the me...

Programming in Unix: Sharing libraries with libraries.

Hi, everyone. Working in C, on top of unix, I am loading and using a shared library somewhat as follows: ... handle = dlopen("nameOfLib"); ... libInit(); ... libGoToState1(); libGoToState2(); .... libTerminate(); ... dlclose(handle); ... What I would like is for my application to admit 'plugins' which take the form of dy...

How do I know if HWND is desktop itself?

I use GetForegroundWindow to get the foreground window handle but if there is no window, then it returns the HWND to the desktop. How do I know if the HWND is the desktop? ...

Php: creating functions in a for () loop

Does anybody know how I could write a function, that was able to create other functions, using the contents of a variable for it's name? Here's a basic example of what I'm talking about in php: function nodefunctioncreator() { for ($i =1, $i < 10, $i++) { $newfunctionname = "Node".$i; function $newfunctionname()...

Linking C library with non-standard name

Hello, I am using gcc to compile a program which I need to link to a C library with non-standard name; it is called stuff.a instead of libstuff.a. I cannot change the name of the file (permission issues). I don't want to include the full library (i.e. using gcc program.c stuff.a -oprogram) I want to compile as gcc program.c -L/path...

C++: Will structure be copied properly?

Hello, I have a pointer to a structure and I need to implement a method that will copy all of the memory contents of a structure. Generally speaking I need to perform a deep copy of a structure. Here's the structure: typedef struct { Size2f spriteSize; Vertex2f *vertices; GLubyte *vertex_indices; } tSprite; And here's...

adding words to a Trie structure in C

Hi I am trying to create a trie structure for an english to spanish word dictionary. Here's what I have so far: struct s_trie_node { char * translation; /* NULL if node not a word */ char * word; /* pointer array to child nodes */ struct s_trie_node * children[UCHAR_MAX+1]; }; int add_word(const char * word, char * tr...

on solaris-sparc platform adding openMp support to an existing C project

Hi all, I need some advise and help for re-compiling of an existing C project (which is a huge project) on a solaris8-sparc platform with "OpenMP". The point is i m not familiar neither with compiling nor parallel programing issues. With a little google search i see that sun-studio 11 and 12 has openMP infrastructure already. so how can...

On the flow C parser

I am looking for a dynamic C-based parser/framework. It must be dynamic because the EBNF is constantly changing, something like bison is not applicable in this situation. And boost::spirit is practically useless to me because it requires C++. Does anyone have an idea? ...

How to read unicode (utf-8) / binary file line by line

Hi programmers, I want read line by line a Unicode (UTF-8) text file created by Notepad, i don't want display the Unicode string in the screen, i want just read and compare the strings!. This code read ANSI file line by line, and compare the strings What i want Read test_ansi.txt line by line if the line = "b" print "YES!" else pri...

safe way to use dprintf

Linux has this nice function dprintf: The functions dprintf() and vdprintf() (as found in the glibc2 library) are exact analogues of fprintf() and vfprintf(), except that they output to a file descriptor fd instead of to a given stream. however as that same source points out: These functions are GNU extensions, not in C or POS...

C Function Pointer Behavior

For a class, I'm writing a simple crypt function. Everything works as expected: int crypt(char *key, int (*callback)(int, char*, int, int)) { int c, i = 0, n = strlen(key); while((c = fgetc(stdin)) != EOF) { // only change the char if it's printable if(c >= 32 && c <= 126) c = callback(c, key, n, ...

Reading a register value into a C variable

I remember seeing a way to use extended gcc inline assembly to read a register value and store it into a C variable. I cannot though for the life of me remember how to form the asm statement. Any help is much appreciated. ...

splint whole program with a complex build process

I want to run splints whole program analysis on my system. However the system is quite large and different parts are compiled with different compiler defines and include paths. I can see how to convey this information to splint for a single file but I can't figure out how to do it for whole program. Does anyone know a way of doing this? ...

Help! strcmp is lying to me when fed strtok results.

Hey Folks, strcmp, when fed the results of strtok, in the following code seems to be blatantly lying to me. int fSize; char * buffer=NULL; char * jobToken = "job"; char * nextToken=NULL; job * curJob=NULL; struct node * head=NULL; struct node * parseList(FILE* file){ fseek(file,0,SEEK_END); fSize=ftell(file); buffer = (cha...

Strings in c, how to get subString

I am pretty new to C. I have a string: char * someString; If I want the first 5 letters of this string and want to set it to otherString, how would I do it? ...

XMMS2: set notifications on title change

I am attempting to set a notification for a title change in XMMS2 for a radio station. I found the values for status changes but none of them seem to correspond to this sort of change. ...

how do I print a binary double array from commandline (unix)

I got binary file, that contains doubles. How do i print that out to a terminal. I've tried octaldump 'od' but cant figure out the syntax I've tried something like head -c80 |od -f But that doesnt work, the man page for od is extremely bad. I've made a c program that does what I want, something like assuming 10double chunks. double...

searching an array in C

I'm working on a problem in C, and I have a quick question about it. The problem is as follows: I'm given some sorted array of integers, say, a[i] = { 1, 2, 3, 3, 3 }. Now, I am supposed to run a program that searches for a given integer, returns the location of the first occurrence and the number of occurrences of that integer in the ...

Why is strlcpy and strlcat considered to be insecure?

I understand that strlcpy and strlcat were designed as secure replacements for strncpy and strncat, however some people are still of the opinion that they are insecure, and simply cause a different type of problem. http://en.wikipedia.org/wiki/Strlcpy#Criticism Can someone give an example of how using strlcpy or strlcat, i.e. a functio...