Skip to content

Tag: gcc

Output system() in C on one line

I have been trying for hours to create a program that outputs something like command[/home/nerdofcode/]: by running something like: printf(“Command[“, system(“pwd”),”]: “);… But the problem I am receiving is that when I go to type input, it starts typing at command[&#…

Ruby, ffi, and a custom C library

I’m trying to create a custom C library I can call from Ruby using FFI. My library will wrap certain libtiff functions with my own code, and the resulting higher-level functions will be called from within Ruby via the FFI interface. I’ve got test code working in C, that compiles successfully to a …

How do you determine where segfault occured when ip (null)?

segfault at 0 ip (null) sp bf9ed55c error 4 in appname[8048000+252000] If I don’t have the IP address, how do I determine where the crash occurred? does it being (null) mean anything useful? in the appname[8048000+262000] = 0x82Aa000 is that supposed to give a clue? is it the 0x82AA000 the value I shoul…

Makefile – wildcard and recipe build

I have the following makefile I got this message : make: Circular src/paquet/packet_implem.o <- src/paquet/packet_implem.o dependency dropped. gcc -std=c99 -Wall -Werror -Wshadow -Wextra -O2 -D_FORTIFY_SOURCE=2 -fstack-protector-all -lz -rdynamic -I/home/jy95/local/include -L/home/jy95/local/lib; /usr/lib…

C code about pointers

I’ve got this simple code that plays with pointers taken from Jon Eriksen’s book that I’m trying to compile but gcc gives me warnings in compilation and segmentation fault (core dumped) when I run it. Output: Answer This program is wrong, and the advice given in the book is obviously wrong, …