C is a general-purpose computer programming language used for operating systems, games and other high performance work and is clearly distinct from C++. It was developed in 1972 by Dennis Ritchie for use with the Unix operating system.

learn more… | top users | synonyms

0
votes
1answer
10 views

How authentication is done between two nodes in tcp/ip or udp client server socket

I have a client socket program and server socket program in C TCP/IP . I execute the server program first on a port say 5000 and then executes client program on the same port and then server respond ...
1
vote
1answer
30 views

“make” doesn't find an installed library

I am attempting to use make to compile purple-facebook, a plugin for pidgin. It requires json-glib, which I have installed, but whenever I attempt to compile, it returns fatal error: json-glib/json-...
0
votes
0answers
7 views

How does the native_cpuid() x86 function set the Extended Processor Info and Feature Bits? [on hold]

The following function from the Linux kernel is a C implementation for utilizing the CPUID call in ASM. static inline void native_cpuid(unsigned int *eax, unsigned int *ebx, ...
0
votes
0answers
8 views

Process Family Tree: list_for_each() [migrated]

I'm reading about Process Management in Robert Love's Linux Kernel Development. He's writing about how one can use the following code to iterate over a process's children struct task_struct *...
-2
votes
0answers
30 views

convert the input from c program using command line [migrated]

I have written the following c code on emacs that can take line inputs from shell and output that on shell. #include <stdio.h> static char string[200]; int main(){ printf("...
3
votes
0answers
114 views

How can I run 'ls' with options from a C program? [migrated]

I want to execute the command ls -a using execv() on a Linux machine as follows: char *const ptr={"/bin/sh","-c","ls","-a" ,NULL}; execv("/bin/sh",ptr); However, this command does not list hidden ...
0
votes
1answer
31 views

Command that indents lines of a C source file

I need a way to auto-indent blocks on a C source file within the terminal. According to the norms. Before: int main() { puts("Hello world"); } After: int main() { puts("Hello world"); }
0
votes
0answers
13 views

setsockopt IPT_SO_SET_REPLACE flag return error (linux) [migrated]

I try to use setsockopt with the flag IPT_SO_SET_REPLACE but i keep getting the wired error from errno Protocol not available this is my code: #include <stdio.h> #include <stdlib.h> #...
0
votes
2answers
74 views

parsing using loop and assigning row numbers to file

It is a bit complicated. i have a configuration file. it looks something like this. customer="airtel" model_name=fast programmer_typ_of="dev" Now the 1st column contains all the keys and whatever ...
3
votes
1answer
35 views

Determine the name of the static/dynamic library

Quite often I am using third party snippets of c code that uses a Unix/Linux c library, an example #include <glib.h>, #include <net/if.h>. And they require me to know the specific library ...
1
vote
1answer
57 views

SSL related “undefined reference” on libssh2 and libcurl libs when compiling C on OpenSUSE

I been trying to compile a C software but I'm getting 'undefined reference' over SSL libraries I think. The libraries it mentions are there, actually I compiled them all again: zlib + openssl + ...
1
vote
0answers
27 views

can two android devices in different network(3g) comunicate themselves with ssh connection?

I have two rooted android devices with different isp(i use different 3g connection for them) and created a double ssh connection(i can with a public ip server)comunicating both to this server(i have ...
0
votes
0answers
24 views

Strange PFN read from pagemap

I m trying to find the physical page to which a range of virtual addresses are mapped in a piece of C code that I ve written. I m using the /proc/self/pagemap to read the mapping. I ve used the code ...
4
votes
0answers
33 views

Linux application development and signal handling

Currently I am having problems with my users complaining about the termination of my application. Under some (seemingly arbitrary) conditions and desktop environments the app is not terminated and ...
0
votes
0answers
25 views

Compile project with cmake for OpenBSD 5.9

I'm writing a shell and have compiled and run it with Ubuntu. It previously built and ran with OpenBSD 5.9 earlier, but now I get compiler error that I don't understand. $ make [ ...
0
votes
0answers
78 views

Where are the definitions for the prototype declarations in <bsd/stdlib.h>?

I have a C program on Ubuntu 16.04, in which I would like to use arc4random_uniform. typedef unsigned char u_char; #include <bsd/stdlib.h> int main () { return (int) arc4random_uniform(100); } ...
1
vote
1answer
49 views

How to read from another terminal?

I opened two terminals (/dev/pts/1 and /dev/pts/2) and started my application from /dev/pts/1. I want to read in real time from /dev/pts/2 but my code doesn't work: actually some of the symbols are ...
0
votes
1answer
29 views

Checking that $((a * b)) evaluates in my own shell [closed]

POSIX seems to define that a shell should be able to evaluate like a calculator the expression $(( a * b)) where * is a binary operator +, - or *. I programmed such a calculator for my own shell and ...
0
votes
1answer
37 views

Can all of fork(), exec() and system() be wrong? [closed]

I understand why it could be less than best practice if I write C code that executes shell commands by calling system() and that it's better to use exec and fork but then a very experienced C ...
3
votes
3answers
212 views

POSIX compliance of the cd program?

Is globbing and shell expansion same thing? I'm learning C by writing a custom shell and I'm also learning POSIX. Now I wonder if it is POSIX compliance that cd - takes you back and that ~ means home ...
1
vote
1answer
112 views

Using Named Pipes in Bash created in a C Program

I have a C code that takes a rather large input. At every iteration, it processes a small chunk of it and it should send that processed chunk to S3 using curl. In the end, it will generate a number of ...
2
votes
2answers
97 views

How can I find out what linker flags are needed to use a given C library function?

Running example C code is a painful exercise unless it comes with a makefile. I often find myself with a C file containing code that supposedly does something very cool, but for which a first basic ...
1
vote
2answers
49 views

How to extract a function from file? [closed]

I am looking for a command to extract a C function from my code. It would be something like: $ grep -func "MyFunction" foo.c int MyFunction(int i) { return i+1; } I know we can extract it with ...
0
votes
0answers
48 views

Build location-independent GCC binaries

I have some problems with GCC. I want a portable version of GCC because the PC I use for programming cannot be connected to Internet due to some driver issues. So, I read an article on how to compile ...
0
votes
0answers
15 views

Error with libraries after setting up Code::blocks to work as an arduino IDE

First of all I apologize in advance if this is the wrong community, you're welcome to advise me another one to post. I followed this guide: http://arduinodev.com/guide-to-arduino-development-...
0
votes
0answers
14 views

Error occured with USB modem

I have MPC8309 Tower Board and connected USB Modem to it and then established Async PPP on Modem, now I started applying ping from different terminal from my laptop by applying nat commands and ...
0
votes
1answer
84 views

Maintaining single binary across Debian distributions

We are currently migrating our system from Debian 6 to 8. The agenda is to try to maintain single binary across OS platforms (x86 based) However, I tried running a Debian 8–compiled binary in ...
1
vote
1answer
80 views

What is the number at the top for the results for ls -l? [duplicate]

When you type in ls -l, there is a number on the first line labeled "total 22037"? What does this number mean? I am attempting to write my own version of ls -l( in C), and how do I get this value or ...
0
votes
1answer
21 views

Busy /dev/gpio. I can shared it?

I need shared one device between two C applications. This device is a buzzer. I've try open this with O_NONBLOCK flag, but result is same: device or resource busy. Is there any possibility to use the ...
0
votes
0answers
39 views

How to call a device's power management methods in another way than during suspend to ram?

Let us consider the e1000e driver for an Ethernet card. This driver provide two power management methods .suspend and .resume to respectively turn off and turn on the card. Those methods are naturally ...
1
vote
1answer
101 views

Why do the Linux kernel headers contain references to nonexistent headers?

I'm trying to build IBCS (source here) on Ubuntu 15.10 (Linux 4.2.35). This module is obviously pretty old, because its CONFIG.i386 file gives gcc an option -m486, which doesn't exist anymore, but ...
2
votes
1answer
99 views

pkg-config output not working with makefile?

I'm trying to run the makefile, shown in this repo, which is a simple Wayland client. But when I run make, it seems that the output of $(WAYLAND) is blank, and it fails to compile due to not being ...
1
vote
0answers
47 views

Is the (Free)BSD Codebase ANSI Compliant?

Google does not seem to shed any light on this topic - But the question is quite simple: Is the FreeBSD (Or any BSD) CodeBase ANSI (c89) Compliant, or does it use c99, c11 or non-standard features ...
3
votes
1answer
56 views

No stdlib in UNIX v7?

Browsing through the v7 UNIX Sources I noticed there is no "stdlib" directory - further more using a v7 UNIX Emulator, there is no such file as <stdlib.h>. However functions like exit() and ...
1
vote
0answers
26 views

Unable to establish PPP on USB dongle?

I have USB Dongle and i am willing to setup ppp through the dongle. I have done following steps to setup ppp. 1.When i plugged the dongle into Ubuntu 14.04. It has been detected as the Mass ...
2
votes
1answer
47 views

non-reentrant libraries in shared memory?

I found this Q&A saying shared libraries can be shared between processes using shared memory. It seems like it would be impossible, though, to share code between processes without some pretty ...
1
vote
0answers
30 views

I2C Read unexplained data [closed]

I am trying to communicate with a PHY device using I2C primitives (read()/write()) in C language in user space. And i am getting some unexplained output in my program. First, the bus number is 2 and ...
0
votes
2answers
48 views

Parent process always printing output after child

Consider the following code running under Solaris 11.3: int main(void) { pid_t pid = fork(); if (pid > 0) { printf("[%ld]: Writing from parent process\n", getpid()); } if (...
1
vote
1answer
49 views

Location of executable file formed after compiling a C program

I have compiled my C source code using: gcc filename.c It got compiled, but I cannot see the executable in the same directory where my source code is. But when I compile my program using: gcc ...
1
vote
2answers
45 views

Run an executable as a service on a port

I have a C program (say a simple Queue system) which I compile and get an executable file. I want to run this executable as a service on a specific TCP port on a CentOS system which I can connect to ...
0
votes
0answers
211 views

Building Handbrake on Debian Jessie

I have found a web site that explains how to install Handbrake 0.9.9 on Jessie. The explanations there seem a bit outdated, because it advises to use SVN to get the sources, but Handbrake has switched ...
0
votes
1answer
121 views

How does one establish SIGRTMIN at run-time?

Reading up on signal(7) I can see that now: two, but once: three; signal numbers past 31 are reserved for use by the Real-time signal system and should not be used: Real-time Signals Linux ...
1
vote
3answers
150 views

Trouble with creating an empty file using C programming language in UNIX environment

I have recently started programming in UNIX environment. I need to write a program which creates an empty file with name and size given in the terminal using this commands gcc foo.c -o foo.o ./foo.o ...
0
votes
0answers
8 views

GDB not copying desired string (Buffer Overflow attempt)

Ok so I am trying to learn about buffer overflows and there is this simple program that is vulnerable of a BoF because it copies the first argument into a buffer of 5 characters. In the source code, ...
0
votes
1answer
95 views

How can I succesfully call the execv function? [closed]

I am trying to make a program that will copy file1 into file2 the following way: cp -i -p file1 file2 Now I call my executable copy and so by calling copy file1 file2 It will do the same thing ...
2
votes
2answers
103 views

Minimal Busybox/Linux Installation - Won't Run C

I'm trying my hand at creating a very minimal custom Busybox/Linux distro, a task that is admittedly above my head, but I figured I'd give it a shot. My issue is that whenever I try to run a C program ...
0
votes
1answer
62 views

How do kthreads actually work?

Need to implement DHCP server in kernel space. It's supposed to be a multithreading server, and I think I should use kthreads ( I'll be glade if you know better decision ). However I can't understand ...
-2
votes
2answers
16 views

Is the flag treated as string in c command argument? [closed]

say I have the following: #include <stdio.h> #include <string.h> int main(int argc, char *argv[]){ if (argv[1] == "-s") { printf("success\n"); } else{ printf("...
1
vote
0answers
92 views

error while compiling my first program in C language? [closed]

I am a newer user of Ubuntu I used to compile c file via Code Block in Win OS. But now I've created a simple program (hello ,world!). This is the code #include<stdio.h> /* demo.c: My first C ...
1
vote
2answers
46 views

Generate raw Ethernet frames with memory preloaded payloads at < 1 ms intervals

I am looking to generate raw Ethernet frames with payload that is preloaded into memory. The Ethernet frames (10-60 full frames) should be generated at 1 ms intervals with no exception. What would ...