If the function was defined with a prototype which explicitly stated the types of the parameters, eg.
void somefunc(int arg1, float arg2);
but is implemented as
void somefunc(int arg1, ...) { ... }
is it possible to use va_arg to retrieve a float? It's normally prevented from doing this because varargs functions have implicit typ...
I want to synchronize the contents of two folders using C. I don't have any line of code, I simple want someone to suggest a good tutorial to start with.
...
I am trying to write a go library that will act as a front-end for a C library. If one of my C structures contains a size_t, I get compilation errors. AFAIK size_t is a built-in C type, so why wouldn't go recognize it?
My header file looks like:
typedef struct mystruct
{
char * buffer;
size_t buffer_size;
size_t *...
There are places where I check for valid pointers before I perform an operation with them; these checks can be nested pretty deeply sometimes.
For example, I have
if (a)
{
if (a->b())
{
if (a->b()->c())
{
a->b()->c()->DoSomething();
}
}
}
I really don't like the look of this. Is there a way to turn this into ...
I have a c function being called from python. Python gives the function an integer, but I would like to use it as another data type in C. I am currently using
PyArg_ParseTuple (args, "i", &value) and then manually doing a cast on value.
Is there a way to do this cast through PyArg?
...
How do we determine where the mistake is in our code that causes a segmentation fault?
After writing some code, to determine where I have a segmentation fault, can gcc show me my have a mistake (or typing error) in a particular line number -- because that line caused the segmentation fault?
...
I realize that what I am trying to do isn't safe. But I am just doing some testing and image processing so my focus here is on speed.
Right now this code gives me the corresponding bytes for a 32-bit pixel value type.
struct Pixel {
unsigned char b,g,r,a;
};
I wanted to check if I have a pixel that is under a certain value (e.g...
I have a semi xml formatted file that contains line with the following format:
<param name="Distance" value="1000Km" />
The first char in the string is usually a TAB or spaces.
I've been using the following to try to parse the two strings out (from name and value):
if(sscanf(lineread, "\t<param name=\"%s\" value=\"%s\" />", name, val...
Hi,
I have a lot of confusion on understanding the difference between a "far" pointer and "huge" pointer, searched for it all over in google for a solution, couldnot find one. Can any one explain me the difference between the two. Also, what is the exact normalization concept related to huge pointers.
Please donot give me the following...
I would like to use OpenBSD's implementation of malloc, realloc and free on my Debian lenny desktop rather than glibc's.
Are they simply drop in replacements: will they work on my Linux desktop ?
Which are the file(s) that I need and which OpenBSD package contains them ?
...
basically I have a texture. I also have a lets say octagon (or any polygon). I find that octagon's bounding box. Let's say my texture is the size of the octagon's bounding box. How could I figure out the texture coordinates so that the texture maps to it. To clarify, lets say you had a square of tin foil and cut the octagon out you'd be ...
I have 2 processes: 1 is writing to a sqlite database, 1 is reading from the same database. Occasioally, I get SQLITE_BUSY on my selects. Is this normal? Is their some option or way I could open the database so that it blocks until it CAN complete the query? (I tried the FULLMUTEX option on the open call but it appeared to have no effect...
how does compiler determine there is run-time error ?
Is it run the code and then decide whether code executable or not?
Another question:
Are there any program which are capable to determine complexity of my
executable code?
Are there any code which is for measuring the time when code start to execute
up to finish?
...
Can anybody give me a C Code to find all possible paths between two nodes?
eg.
if the graph has following edges
1-2
1-3
2-3
2-4
3-4
all paths between 1 and 4 are:
1-2-3-4
1-2-4
1-3-4
1-3-2-4
...
Every time I run this I encounter a segmentation fault?
I have not found my fault as sometimes gcc emits a segmentation fault and sometimes the memory stack limit is exceeded.
This is the code.
#include <stdio.h>
#include <stdlib.h>
#include "labheader.h"
void my_main()
{
char *tutar[50],tempc;
int i=0,temp,g=0...
I need to read a file and send the text from it to a string so I can parse it. However, the program won't know exactly how long the file is, so what would I do if I wanted to use fgets, or is there a better alternative?
Note:
char *fgets(char *str, size_t num, FILE *stream);
...
How can i call a function whenever my gtkmm app looses or regains focus?
Thanks.
...
Hi folks,
I am new to C, and now read some textbook and going to apply its examples.
The problem is, whenever I creates a new project and try to put more than one file that contains a main function, the linker (as I thougt0 explains saying:
/home/mohammed/tmp/abcd/main.c:4: multiple definition of `main'
(BTW, I used many IDEs, MonoD...
A crazy question, but is there anyway to discover the default gateway without DHCP?
This would be for a device on a network which does not use DHCP which does not have an IP address as yet. I was thinking if I could discover the default gateway, then i could try to guess an unused ip address then broadcast on the network to see if it's ...
I am using sqlite c/c++ interface.
Now here is my scenario -
I have 3 tables (related tables) say A, B, C.
Now, there is a function called Set, which get some inputs and based on the inputs
inserts rows into these three tables. (sometimes it can be an update in one of the tables)
Now I need two things.
One, i dont want autocommit ...