Whether we're maintaining unfamiliar code or checking out the implementation details of an Apache module it can help if we can quickly traverse the code and build up an overview of what we're looking at. Grep serves most of my daily needs but there are some cases where it just wont do.
Here's a common example of how it can help. To find...
Hi people, this is my first post here!
I'm trying to make a windows forms program using C# which will use a precompiled C library. It will access a smart card and provide output from it.
For the library, I have a .dll, .lib and .h and no source. In the .h file there are several structs defined. Most interesting functions of the .dll exp...
I tried searching on the net, but there are hardly any resources. A small example would suffice.
EDIT
I mean, two different C programs communicating with each other. One program should send "Hi" and the other should receive it. Something like that.
...
Or in my particular case a windows region (HRGN)?
Updated:
The problems is the following:
I've a collection of objects, each of these objects can hold a HRGN. These region once acquired is released when the object is destroyed. Since some of those objects are stored in a std::vector I've to define an assignement operator.
Until now I...
In his FAQ @ http://www2.research.att.com/~bs/bs_faq.html#bootstrapping, Bjarne Stroustrup says:
To build [Cfront, the first C++
compiler], I first used C to write a
"C with Classes"-to-C preprocessor. "C
with Classes" was a C dialect that
became the immediate ancestor to C++...
I then wrote the first version of
Cfront i...
Hello,
I have written a simple Hello World program.
#include <stdio.h>
int main() {
printf("Hello World");
return 0;
}
I wanted to understand how the relocatable object file and executable file look like.
The object file corresponding to the main function is
0000000000000000 <main>:
0: 55 ...
I'v been trying to anti alias with OGL. I found a code chunk that is supposed to do this but I see no antialiasing. I also reset my settings in Nvidia Control Panel but no luck.
Does this code in fact antialias the cube?
GLboolean polySmooth = GL_TRUE;
static void init(void)
{
glCullFace (GL_BACK);
glEnable (GL_CULL_FACE);
glB...
From a basic test program. . .
package main
/*
#include <stdio.h>
static void test() {
printf("hello world");
}
*/
import "C"
func main() {
C.test();
}
I do "cgo hello_cgo.go" and get:
_cgo_.o
_cgo_defun.c
_cgo_gotypes.go
hello_cgo.cgo1.go
hello_cgo.cgo2.c
How do I go about compiling from here to an exe?
...
Ok, so I have a 2D Array that is initialised with values from a file (format: x y z).
My file reads in the values correctly but when adding the z value to the matrix/2DArray, I run into a segfault and I have no idea why. It is possibly incorrect use of pointers? I still don't quite have the hang of them yet.
This is my intialiser, wor...
In short: I want to generate two different source trees from the current one, based only on one preprocessor macro being defined and another being undefined, with no other changes to the source.
If you are interested, here is my story...
In the beginning, my code was clean. Then we made a new product, and yea, it was better. But the co...
hi,
I wanted to have function which will accept as
foo(...)
{
//......
}
usage of this would be
foo(1,2,3);
foo(1)
foo(1,2,3,4,5,5,6);
va_list can be used but again for that I have to pass foo(int count, ...), as this at run time i dont know how many argument i have.
any pointer would be appreciated
Thanks
...
How can I find where the error occurs?
In C language, the return value means what error occurs,
such as failure to open file or memory allocation.
There is no information where the error occurs.
For example, function 'foo' calls A,B,C,D.
If foo returns an error value, it might be return value of A or B or C or D.
I cannot find what func...
If you have 2 Matrices of dimensions N*M.
what is the best way to get the difference Rect?
Example:
2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3
2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3
2 3 4 5 4 3 2 3 <---> 2 3 2 3 2 3 2 3
2 3 4 5 2 3 2 3 2 3 2 3 2 3 2 3
2 3 2 3 2 3 2 3 ...
a ip or other string, like "11.22.33.44" or "aa.bb.cc.dd". basically, I think it is very easy, (([\d\w]+)+\.)+[\d\w]+
but the problem is which group these submatches are in. not like ip, some string is consist of lots of words+separate
in pcre, I don't know how to extract it all words -- "aa bb cc dd ..."
...
Answering to another StackOverflow question (this one) I stumbled upon an interresting sub-problem. What is the fastest way to sort an array of 6 ints ?
As the question is very low level (will be executed by a GPU):
we can't assume libraries are available (and the call itself has it's cost), only plain C
to avoid emptying instruction ...
I'm working on a school project that involves taking a lat/long point and finding the top five closest points in a known list of places. The list is to be stored in memory, with the caveat that we must choose an "appropriate data structure" -- that is, we cannot simply store all the places in an array and compare distances one-by-one in...
I am looking for tool that can convert .Glade (or xml) file to C source.
I have tried g2c (Glade To C Translator) but i am looking for windows binary.
Any one does know any good tool for window.
Thanks,
PP.
...
Hi
In my app, for debugging I want to save a pointer, before I do other operations on it, e.g.
void foo(...)
{
/* suppose ptr1 points to one of my structs */
ptr1 = NULL;
/* before that ptr1=NULL I want to save value of that pointer - how to do it ? */
}
Thanks for any help
...
I have a source code of a library which has a lot of strange IF, ELSE, FOR, etc. macros for all common C-keywords instead of using just usual if,else,for,while keywords. These macros are defined like this:
#define IF( a) if( increment_if(), a)
where increment_if() function is defined so:
static __inline void increment_if( void) {
...
Please have a look at the below mentioned code snippet and tell me the difference?
int main()
{
struct sockaddr_in serv_addr, cli_addr;
/* Initialize socket structure */
bzero((char *) &serv_addr, sizeof(serv_addr));
}
Now, what if i do something similar without typecasting (char *), then also i feel it will do the same thing? Can...