Questions tagged [libc]

The C standard library consists of a set of sections of the ISO C standard which describe a collection of headers and library routines used to implement common operations, such as input/output and string handling, in the C programming language.

The C standard library consists of a set of sections of the ISO C standard which describe a collection of headers and library routines used to implement common operations, such as input/output and string handling, in the C programming language.

There are many implementations of libc with different resource requirements, security goals, etc. With a typical tool chain the libc, compiler and OS work together to achieve some ISO, Posix or custom features/standards. Some libc implementation are only a subset of the ISO standard, but still full featured enough to be used in many applications.

Specific libc tags:

  • - the full Gnu Libc found on most GCC installs.
  • - a smaller micro-controller libc for resource constrained devices
  • - Android libc
  • - unhosted libc
  • - more modern lighter foot print libc

Websites

See also:

Do not confuse with , which is for the C++ programming language.

1076 questions
0
votes
1 answer

Is it possible to tweak your computer's random function?

In order to cheat the game 2048 for fun, does anyone know how to change the random implementation on Windows or Linux? On a linux kernel, I guess that you reimplement the rand function simply like this: double rand() { return 0.0; } then rebuild…
superrache
  • 650
  • 11
  • 26
0
votes
2 answers

Macro within macro with malloc leads to runtime error?

I have this piece of code #define MZERO(a, s) (a==NULL ? NULL : memset(a, 0, sizeof(a)*s)) #define MALLOC(t) (t*)malloc(sizeof(t)) #define CALLOC(t, s) s<=0 ? NULL : (t*)MZERO(calloc(sizeof(t), s), s) which basicaly lets me get around the…
rath
  • 3,655
  • 1
  • 40
  • 53
0
votes
0 answers

Why does the definition of printf name it __printf

In the printf.c file of the glibc source code package, the function is declared with underscores in the name. Why? int __printf (const char *format, ...)
A1A2A3A4
  • 413
  • 1
  • 5
  • 11
0
votes
1 answer

fgets not blocking in descriptor promoted to stream

I am using fgets in a small C program - running under Ubuntu - to read data coming from Arduino via its FTDI USB/Serial converter. I am using low level I/O function from GNU libc (since I want - in the future - be able to control baud rate etc) and…
ginsi
  • 11
  • 1
0
votes
1 answer

exception generated with qtconcurrent and calling QTime:currentTime

I seem to be getting an exception generated only with a thread created with Qtconcurrent::run I have a class named FPSengine which has a method named FPSengine::getData() that is called by the main thread and 3 other threads (2 QThreads and 1 made…
yan bellavance
  • 4,710
  • 20
  • 62
  • 93
0
votes
1 answer

Stripping libc.so.6 of FS register

I'd like to compile glibc and get rid the binary of the register FS (used for indexing). I'm compiling using the following: make CFLAGS='-O1 -U_FORTIFY_SOURCE -fno-stack-protector -mno-tls-direct-seg-refs' But the resulting binary still uses the…
badnack
  • 737
  • 1
  • 11
  • 20
0
votes
1 answer

Where does Dietlibc define function _start?

I'm successfully doing some prototyping using dietlibc. For linking, I need function _start as entry point, and I'm currently using the one of newlib that is in crt0.o [1]. Where can I find the function _start of dietlibc? [1]…
Martin Monperrus
  • 1,845
  • 2
  • 19
  • 28
0
votes
1 answer

Android NDK JNI call libc function

I was wondering whether the calling of a libc function in a native function done via JNI with the Android NDK, e.g. FILE* file = fopen("sdcard/hello.txt","w+"); is actually going directly to the actual libc function or whether there is some…
JoachimR
  • 5,150
  • 7
  • 45
  • 50
0
votes
1 answer

Android Source: Is fopen() in bionic libc only used for system internal apps?

I created an NDK application that does the following successfully: #include #include #include JNIEXPORT jstring JNICALL Java_my_package_NativeAccess_stringFromJNI( JNIEnv* env, jobject thiz) { …
JoachimR
  • 5,150
  • 7
  • 45
  • 50
0
votes
1 answer

Static linking of Libc

I'd need to statically link all the dependencies of a binary in the binary itself (that is also the libc). I've tried the option -static-libgcc but it did not worked, the size of compiled binary is the same as the dynamic compiled one (that is…
badnack
  • 737
  • 1
  • 11
  • 20
0
votes
1 answer

How to implement futimes in terms of utimes?

Given that in Linux utimes(2) is a system call and futimes(3) is a library function, I would think that futimes is implemented in terms of utimes. However, utimes takes a pathname, whereas futimes takes a file descriptor. Since, it is "not possible"…
levzettelin
  • 2,600
  • 19
  • 32
0
votes
2 answers

Handle inputs on stdin in C

I'm new @programming and i have the following question: My Programm start an command prompt: like input> Then the user enters an string, a command like merge xyz.txt I've finally got it to run, that my programm only reads from the start to the…
0
votes
1 answer

c++ program shows very different memory behaviour on different machines

I have written a computer simulation in C++ that needs a lot of memory. It runs in iterations, and in each iteration allocates a large amount of memory that should be freed at the end of the iteration. It also uses c++11's implementation of
janoliver
  • 7,744
  • 14
  • 60
  • 103
0
votes
1 answer

mingetty error while loading shared library libc.so.6

I have a 64bit CentOS 5.5 box that I recently upgraded to 5.6. During the upgrade, I removed the unnecessary 32 bit packages (i*86 architecture packages) since they are not really valid for 64 bit machines. As well, I removed some other packages…
Trenin
  • 2,041
  • 1
  • 14
  • 20
0
votes
1 answer

Is malloc/realloc/calloc used?

For C programmers. How can I know if a pointer char *, for example, was initialized by using malloc or realloc? I mean in kind of that function: char* func(char** x){ /* need some reallocating of *x but * *x can be a pointer to const…
Pycz
  • 366
  • 3
  • 12