libc

CLang libc, libc++ on Windows with debugging symbols compatible with Visual Studio

老子叫甜甜 提交于 2020-01-01 14:20:18
问题 I'm trying to find info and I don't see it on clang web site. I'm thinking to try to use it on windows, but I have no clue if it has it's own libc or it uses broken libc from MS? another question: if i compile code with clang, will I be able to use visual studio as a debugger, e.g. is clang capable of emitting debugging symbols in MS format (this is the reason I don't want to use gcc; and this is something that intel compiler can do, but it uses MS's libc). In short, I'd like to be able to

Atomically swap contents of two files on Linux

ε祈祈猫儿з 提交于 2020-01-01 11:34:29
问题 I have two files, A and B , each with its own content. I would like to swap these two files, so A would become B , and B would become A . But I would like to do with a guaranty that no other process will find these two files in an inconsistent state, nor any process will find any of those files missing, even for a short while. So, as a side operation, I would also like to have a guaranty that if anything would go wrong during the operation, nothing will be changed (kind of like a transaction

Application crash libc: Fatal signal 11 (SIGSEGV), code 1

非 Y 不嫁゛ 提交于 2020-01-01 06:40:07
问题 I have next fatal error: A/libc(30888): Fatal signal 11 (SIGSEGV), code 1, fault addr 0x8 in tid 30897 (FinalizerDaemon) I have no ideas what went wrong. Perhaps this is due to RxJava , GsmTaskorService or Greendao 3 . My stacktrace below: 05-20 22:30:03.138: W/CursorWindow(30888): Window is full: requested allocation 72 bytes, free space 43 bytes, window size 2097152 bytes 05-20 22:30:03.170: W/art(30888): Suspending all threads took: 16.742ms 05-20 22:30:03.188: D/greenDAO(30888): Window vs

What does “f” stand for in C standard library function names?

三世轮回 提交于 2019-12-31 19:19:11
问题 What does f stand for in the name of C standard library functions? I have noticed that a lot of functions have an f in their name, and this does not really make sense to me. For example: fgets , fopen , printf , scanf , sqrtf and so on. 回答1: Your question in general is too general but I can explain a few examples. f gets, f open, f close, … — The ”f“ stands for “file”. These functions accept or return a FILE * pointer as opposed to a file number as the POSIX functions do. print f , scan f , …

What does s[-1] = 0 mean?

女生的网名这么多〃 提交于 2019-12-30 09:59:07
问题 I'm studying the code of the function strtok from bsd's libc, when I ran it in my machine, the program received signal SIGSEGV in s[-1] = 0 . Here's the link to the code. Is s[-1] = 0 right? This is my code: #include <stdio.h> #include <stdlib.h> #include "strtok.c" int main(int argc, char* argv[]) { char* str = "xxxx xxxyy fdffd"; const char* s = " "; char* token = strtok(str, s); while (token != NULL) { printf("%s\n", token); token = strtok(NULL, s); } return 0; } 回答1: s[-1] Is expanded to:

What is the difference between /lib/i386-linux-gnu/libc.so.6, /lib/x86_64-linux-gnu/libc.so.6 and /usr/lib/x86_64-linux-gnu/libc.so?

给你一囗甜甜゛ 提交于 2019-12-30 03:24:04
问题 I installed Matlab in my Linux Mint 14 Nadia (a uname -a shows: Linux Ideapad-Z570 3.5.0-17-generic #28-Ubuntu SMP Tue Oct 9 19:31:23 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux) and when calling it from the command line I would get a: "/lib64/libc.so not found". I followed the help on mathworks by making a link in /lib64 as: ln -s /lib/x86_64-linux-gnu/libc.so.6 . That solved the issue. Now, if I do a locate of this library I get: locate "libc.so" /lib/i386-linux-gnu/libc.so.6 /lib/x86_64-linux

Small libc for embedded systems [closed]

瘦欲@ 提交于 2019-12-29 18:38:49
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed last month . I am looking for a small libc for embedded use with freertos on a ARM7 microcontroller. I have looked at newlib, but it is a bit too complex for my needs. Newlib calls malloc() in a number of functions (e.g. printf()), which is not good for small embedded realtime systems. Does anyone know of a small, portable,

Can you determine the source IP and port from a connected TCP socket?

醉酒当歌 提交于 2019-12-25 06:21:01
问题 I'd like to have my server determine the source IP and port of a client from a connected TCP socket. Since my clients are likely behind NAT's, I can't rely on being told by the client (in the protocol of the connection)... If this is possible, I'm going to need to implement it on both Windows and Linux... But an answer for either would help get me started... I am using C, and I'm looking for either libc or msvcrt based solutions. 回答1: Should work both in linux and windows: struct sockaddr_in

cmpfunc in qsort() function in c

 ̄綄美尐妖づ 提交于 2019-12-25 03:45:27
问题 Can someone explain me cmpfunc which is used in the qsort function? What are a and b in this function and what are they pointing to? int cmpfunc(const void *a, const void *b) { return(*(int*)a - *(int*)b); } 回答1: a and b in cmpfunc are pointers to const void type. cmpfunc can accept pointer to elements of array of any data type. void * pointer can't be dereferenced, therefore a cast int * is needed before dereferencing. 回答2: In this inputs are *void and you need to comaper integers in your

strsep segmentation faults on different string pointer/array types

ε祈祈猫儿з 提交于 2019-12-24 12:15:00
问题 Platform: Linux, OSX Compiler: GCC I've got a simple program which is currently confounding me - I know that I'm messing with a couple different kinds of arrays/pointers to produce this problem - its intentional - I'm trying to understand it. The code as listed will compile and run as expected, but changing data4 in the call to strsep(&data4, "e"); to data1 or data3 causes a segmentation fault. I would like to understand why. #include <stdio.h> #include <string.h> int main(int c, char** v) {