go – CGo segfault when returning C.CString-ThrowExceptions

Exception or error: I am trying to call a Go function from C code, but I encountered a issue which I can’t really explain: C: char * ret; CheckDpkgInfo(&ret); printf(“%s”, ret); Go: func CheckDpkgInfo(dpkg_c **C.char) { *dpkg_c = C.CString(“whatever”) } This works, but not when I simply return a c string from Go (segfault): C: …

string – put() prints duplicate lines in c-ThrowExceptions

Exception or error: Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 12 days ago. i was trying to run following code: #include<stdio.h> void main() { int c; while((c=getchar()) !=EOF) putchar(c); } i typed “hi” …

c – Comparing string with if condition-ThrowExceptions

Exception or error: This question already has answers here: How do I properly compare strings? (8 answers) Closed 27 days ago. I am comparing string using if condition but the second if condition is failing. What will be the reason of fail and what happens in compiler level in these comparing cases? char *c = …

c – O(n) substring algorithm-ThrowExceptions

Exception or error: so i’ve been researching about substring searching algorithms and found out that most algorithms like the kmp and the rabin-karp algorithm need an extra amount of time complexity for preprocessing time before doing some string matching. is there any benefit in doing so? and why wouldn’t they simply skip to the string …

c – Optstring options in getopt function-ThrowExceptions

Exception or error: I am making a command line “replace” which must looks like: replace OPT Old_Word New_Word — files_to_be_replaced OPT can be: -l -f -i -b The program must be able to handle strings starts with “-” and “–“. and this is from the CNU specification: an element of argv that starts with “-” …

c – <bsd/string.h> for windows-ThrowExceptions

Exception or error: I am using strlcpy, strlcat , strtok_r functions in my c program. When I compiled it I got undefined reference to `strlcpy’, undefined reference to `strlcat’, undefined reference to `strtok_r’ I googled and found out I need to use <bsd/string.h> . But I found resources only for installing libbsd for linux. Can …