Hello,
gcc 4.4.1 c89
I have the following code snippet:
#include <stdlib.h>
#include <stdio.h>
char *buffer = malloc(10240);
/* Check for memory error */
if(!buffer)
{
fprintf(stderr, "Memory error\n");
return 1;
}
printf("sizeof(buffer) [ %d ]\n", sizeof(buffer));
However, the sizeof(buffer) always prints 4. I know t...
In glibc malloc.c or dlmalloc It said "repositioning tricks"As in blew, and use this trick in bin_at.
bins is a array,the space is allocated when av(struct malloc_state) is allocated.doesn't it? the sizeof(bin[i]) is less then sizeof(struct malloc_chunk*)?
When bin_at(M,1)(which is used as unsorted_chunks) is called,the result is: bin[...
I always wondered how software such as iTunes, Winamp etc is able to create its own UI.
How is this accomplished under the Windows platform? Is there any code on the web explaining how one would create their own custom GUI?
...
One aspect where C shows its age is the encapsulation of code. Many modern languages has classes, namespaces, packages... a much more convenient to organize code than just a simple "include".
Since C is still the main language for many huge projects. How do you to overcome its limitations?
I suppose that one main factor should be lots ...
Hi,
I have some old hardware with an old version of say SuSE linux running on it. Now I have this fancy development machine running Ubuntu 9.10. Some of the tools I use to compile my C app (written in Python 2.6.x) are not available on the old SuSe box. So... is it possible to compile for that old machine on my dev box?
I have the foll...
Hello,
I want to build a static library (*.LIB file) GNU libiconv on windows to be used with other libraries in Visual C++. Other libraries I'm using are built with "MultiThreaded DLL" (/MD) Runtime option. So, I need to build libiconv with the same option.
Problem is the libiconv uses GNU build system and I want to compile with /MD op...
A[50][5000];
for(i=0;i<50;++i)
scanf("%[\n]",A[i]);
%[^\n]
usage and meaning of it
and can i use that struct like
%[\t]
%[\a]
...
I have a JSON API that I need to provide super fast access to my data through.
The JSON API makes a simply query against the database based on the GET parameters provided.
I've already optimized my database, so please don't recommend that as an answer.
I'm using PHP-APC, which helps PHP by saving the bytecode, BUT - for a JSON API tha...
I am trying to find a lib file that I created. I changed the configuration type to static lib. Then I rebuild the application. When I go to the debug folder in windows, I see the .lib file. but when I create a new application and try to add it to "additional Library Directories" I go to the exact folder and it does not show up.
...
I have the following variables:
char *p;
int l=65;
Why do the following casts fail?
(int *)p=&l;
and:
p=&((char) l);
...
I'm making an XML generator library for Objective-C in iPhone.
It's pretty big work making fully standard based generator. So I'm finding a well-documented, stable, proven C lib for generating XML document string by commands (or events) like SAX parser.
Any recommendations?
...
Many places I saw that we can use startupinfoex structure in CreateProcess function. But when I checked the signature is only allowing startupinfo structure. Can anybody please give a snippet how startupinfoex can be used with createprocess function. Thanks in advance....
...
I have an urgent project which need many functions of a calculator (plus a few in-house business rule formulas). As I won't have time to re-invent the wheel so I am looking for source code directly.
Requirements:
BSD-like licensed (commercial use friendly, GPL won't help)
in c/c++ programming language
32-bit CPU
minimum dependency on...
Rather than assigning a pointer to NULL, is there any way to set the location in memory the pointer is pointing to, to NULL so that any other pointer pointing to that location will be NULL?
...
Hello,
I am just wondering would it be better to do this:
if((fd = open(filename, O_RDWR)) == -1)
{
fprintf(stderr, "open [ %s ]\n", strerror(errno));
return 1;
}
or this
fd = open(filename, O_RDWR);
if(fd == -1)
{
fprintf(stderr, "open [ %s ]\n", strerror(errno));
return 1;
}
Many thanks for any suggestions,
...
Is there a decent open-source C library for storing and manipulating
dynamically-typed variables (a.k.a. variants)? I'm primarily interested in atomic values (int8, int16, int32, uint, strings, blobs, etc.), while JSON-style arrays and objects as well as custom objects would also be nice. A major case where such a library would be usef...
The ISO C Standard (ISO/IEC 9899) and the ISO C++ Standard (ISO/IEC 14882) are not published online; instead, one must purchase the PDF for each of those standards. I am wondering what the rationale is behind this... is it not detrimental to both the C and C++ programming languages that the authoritative specification for these languages...
hi I would like to ask how I would modify this code for the question: (It only accepts one input then prints it out. I want it to keep going until I hit enter (\n) twice.
#include <stdio.h>
#define MAXLENGTH 1000
int main(void) {
char string[MAXLENGTH];
fgets(string, MAXLENGTH, stdin );
printf("%s\n", string);
return ...
I am coding up something using the JNI Invocation API. A C program starts up a JVM and makes calls into it. The JNIenv pointer is global to the C file. I have numerous C functions which need to perform the same operation on a given class of jobject. So I wrote helper functions which take a jobject and process it, returning the needed...
I'm trying to read hexa data(color value ex. 0xffffffff) from txt file...
but i don't know how to read it....
i declared the color value like 'uint color' and i want to change the value though txt file.
if i use int data i can use 'atoi' function, but what can i use function for uint?
...