Category "c"

How to build a standalone C ELF binary without installing libraries on a remote machine?

I am trying to build a C ELF binary on linux and try to execute it directly on another machine. (Sent via scp linux command) The problem is that even when I bui

Tree traversal - Segmentation fault error

Code : #include<stdio.h> #include<malloc.h> typedef struct tree { char data; struct tree *left; struct tree *right; }*pos; pos stack[

/bin/cat :Bad file descriptor

I am pretty new to the pipe(), fork() functions and /bin. I would like to pass a value through a pipe from my first child to my second child that I will later u

Uncommon baud rate on serial port - Linux

I'm currently trying to make a programm to read a serial port. On this port I receive data with a baud rate of 875000. It's really uncommon and I don't succeed

Reading C program's output files in javascript

I'm trying to connect two programs I wrote- one is a c program that outputs files to my local disk and the other is a web program that's supposed to show the co

XINU - How can I take control over an interrupt vector

Well, I've met this question a lot in OS, we've implemented this by diff. ways (Inline Assembly with setvect, getvect, etc..) At XINU it's a little bit differe

How to create a folder in C

How can I create a new folder for an email manager, I have this code but It doesn't work. void create_folder() { int check; char * dirname; clrscr();

How to debug in kernel mode using printk

I am trying to add some stuff to Linux task_struct. In this area I copy a string from the user and try to store it in my struct. I try to debug my code by add

How to download a file from http using C?

I spent the last days trying to figure out how to download a file from an URL. This is my first challenge with socket and I'm using it to have an understanding

What is the difference between C, C99, ANSI C and GNU C?

I have started programming practice on codechef and have been confused by the difference between C and C99. What does C mean here? Is it C89? Check the language

How can a shared library (.so) call a function that is implemented in its loader code?

I have a shared library that I implemented and want the .so to call a function that's implemented in the main program which loads the library. Let's say I have

What is the correct input to have the program print the sentence: Exactly! Good Job

Read and understand the following code. Provide the correct input to have the program print the sentence: Exactly! Good Job. Before submitting your answer, plea

Does gcc use Intel's SSE 4.2 instructions for text processing if available?

I read here that Intel introduced SSE 4.2 instructions for accelerating string processing. Quote from the article: The SSE 4.2 instruction set, first implement

Netlink : Receiving data multiple times from kernel

I recently encounter a problem when I'm using netlink to transfer many data between userspace and kernelspace. For example, function in userspace releases a req

Print character array as hex in C

I have a 2D array called char **str (allocated by malloc). Lets say str[0] has the string "hello". How would I print that hex? I tried printf("%d\n", (unsigned

C/C++ unsigned integer overflow

i'm reading an article about integer security . here's the link: http://ptgmedia.pearsoncmg.com/images/0321335724/samplechapter/seacord_ch05.pdf In page 166,th

Why wasn't a specifier for `float` defined in `printf`?

It looks like it could have been, there are (at least in C99) length modifiers that can be applied to int: %hhd, %hd, %ld and %lld mean signed char, short, long

STM32F407 Register Level Clock Configuration Issue

I am working on an STM32F407 Discovery Board. But I didn't solve my clock configuration problem. I want to 168 MHz working frequency and I get help from CubeMX

Generate a random byte stream

I'm testing a network program that sends packet to a remote server using UDP/TCP, and for that, I want to generate some random byte streams. Here's the functio

maximum (and minimum) off_t

I could not find something like OFF_MAX that would tell me the maximum allowed value for off_t so I wonder if I could perhaps use that: #define OFF_MAX ~((off_