I have included the header netdb.h, where getaddrinfo is included, but gcc issues this warning:
warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
gcc -m32 -static -s -O2 -std=c99 -D_POSIX_C_SOURCE=200112L myprogram.c
How can I statically comp...
Is there a standard C library function to escape C-strings?
For example, if I had the C string:
char example[] = "first line\nsecond line: \"inner quotes\"";
And I wanted to print
"first line\nsecond line: \"inner quotes\""
Is there a library function that will do that transformation for me? Rolling my own just seems a little sil...
Problem:
I'm trying to use a library named DCMTK which used some other external libraries ( zlib, libtiff, libpng, libxml2, libiconv ). I've downloaded these external libraries (*.LIB & *.h files ) from the same website. Now, when I compile the DCMTK library I'm getting link errors (793 errors) like this:
Error 2 error LNK2005: __e...
Hi, everyone
Please take a look at this piece of code. I'm allocating one byte for the first variable and another byte for the second one. However, it seems like the compiler allocates more (or I'm missing something). The program outputs both strings, even though their length is more the one byte.
void main() {
char* some1 = mallo...
Dear all,
I am working on a project in which I have to develop bio-passwords based on user's keystroke style.
Suppose a user types a password for 20 times, his keystrokes are recorded, like
holdtime : time for which a particular key is pressed.
digraph time : time it takes to press a different key.
suppose a user types a password ...
Here is my main function:
int main(int argc, char **argv)
{
LoadFile();
Node *temp;
char *key;
switch (GetUserInput())
{
case 1:
temp = malloc(sizeof(Node));
printf("\nEnter the key of the new node: ");
scanf("%s", temp->key);
printf("\nEnter the value of the new node: ");
scanf("%s", temp->value);
AddNode(...
BACKGROUND:
I'm writing a single level cache simulator in C for a homework assignment, and I've been given code that I must work from. In our discussions of the cache, we were told that the way a small cache can hold large addresses is by splitting the large address into the position in the cache and an identifying tag. That is, if you h...
I know this topic has been covered ad nauseam here, and other places on the internet - but hopefully the question is a simple one as I try to get my head around assembly...
So if i understand correctly the ebp (base pointer) will point to the top of the stack, and the esp (stack pointer) will point to the bottom -- since the stack grow...
In my class we are writing our own copy of C's malloc() function. To test my code (which can currently allocate space fine) I was using:
char* ptr = my_malloc(6*sizeof(char));
memcpy(ptr, "Hello\n", 6*sizeof(char));
printf("%s", ptr);
The output would typically be this:
Hello
Unprintable character
Some debugging figured that my co...
I want to implement a layering system in my application and was thinking of creating a bunch of transparent bitmaps, adding content to them then blitting them on top of each other, how can this be done without setting each pixel to (0,0,0,0). I'm using Pure win32, not MFC, thanks.
...
C doesn't have (to the best of my knowledge) overloading or templates, right? So how can a set of type-agnostic functions with the same name exist in plain ol' C? The usual compile-time trickery would involve a whole bunch of macros, wouldn't it?
...
Hi
I have to develop an ActiveX(ocx) in native C. Can some one help me or is there any IDE for developing ActiveX in native C.
Thanks
...
if I want to construct a const char * out of several primitive type arguments, is there a way to build the string using a similar to the printf?
...
During compilation and linking.....what is use of .exp and what is the difference between .lib and .dll . I know that .lib will be used while linking and .dll will be used when running the program... but what exactly is the difference between .lib and .dll
does .lib files does not contain the code for the functions comming from .dll fi...
HI how can i create .lib files and .dll files in VC++ (cl.exe) from command line
Thanks in advance
...
I load scripts using luaL_loadfile and then lua_pcall from my game, and was wondering if instead of loading them into the global table, I could load them into a table named after their filename?
For example:
I have I file called "Foo.lua", which contains this:
function DoSomething()
--something
end
After loading it I want to be ...
in c printf() returns what?
...
This loop is supposed to take data from a socket line by line and put it in a buffer. For some reason, when there is no new data to return, recv returns the last couple lines it got. I was able to stop the bug by commenting out the first recv, but then I cant tell how long the next line will be. I know it's not a
while(this->connected)...
hi,all
i am a new object-c developer,i wanna implement Tea Algorithm, but i don't know more about the byte infomation ,so i cant control the string byte stream .who can tall me how to implement this Algorithm. thanks.
...
I want to supply the shared libs along with my program rather than using the target system's due to version differences:
ldd says my program uses these shared libs:
linux-gate.so.1 => (0xf7ef0000)(made by kernel)
libc.so.6 => /lib32/libc.so.6 (0xf7d88000)(libc-2.7.so)
/lib/ld-linux.so.2 (0xf7ef1000)(ld-2.7.so)
I have successfully lin...