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

3
votes
2answers
569 views

Why does Linux have a C compiler by default?

Why does a Linux distribution have gcc installed in advance? Is it because most of the applications in linux are written in C? What would happen if the gcc directory is deleted?
1
vote
1answer
146 views

Parsing protocol and url from packet payload

We are using pf_ring to capture packets. We are able to decipher information like source and destination ip, mac etc from the header information. Now we are moving into payload to decide the type of ...
3
votes
0answers
142 views

Fork vs. thread system time [closed]

I got the following logs: Program 1: Taken from a program executed 64 fork calls: real 0m0.023s user 0m0.068s sys 0m0.008s Program 2: Taken from a program executed 64 thread calls: real 0m0.613s ...
2
votes
1answer
187 views

Dependencies problem with automake

I am using automake on Debian Squeeze for compiling a very simple C project with 6 source files. The issue comes when I try to compile the sources using the generated Makefile. One of the sources ...
10
votes
2answers
212 views

Is there a way to mirror USB outputs?

I'm currently writing a program for a project. It is for a braille reading system where I have a braille display connected via USB that is controlled by a program called brltty. One of the ...
1
vote
1answer
159 views

How to trace process scheduling of certain process?

For a project at my university I am researching ways to trace, log and manipulate the process scheduling of certain processes. I would like to launch an number of applications, everyone in a single ...
4
votes
4answers
605 views

Is it possible to make multi-level directory? [duplicate]

Using mkdir() (the C function) I can create a 1-level directory, if I want to create multi_level directory like: folder/subfolder/subsubfolder is it possible? if so, how?
4
votes
1answer
157 views

Effect of static and dynamic linking on start address

I have a simple C program. I run: $ gcc Q1.c -Wall -save-temps -o Q1 Then I inspect the executable generated: $ objdump -f Q1 Q1: file format elf32-i386 architecture: i386, flags 0x00000112: ...
3
votes
3answers
450 views

default wordsize in UNIX/Linux

I was inspecting the preprocessed output of my C program and happened to look at the header file wordsize.h It is located in /usr/include/i386-linux-gnu/bits/wordsize.h the file contains only one ...
4
votes
1answer
96 views

Portions of the file Header

I was working through my C programs, I am new to Linux/UNIX development and was having a look around. I created a simple C program of Hello world and was inspecting the compilation process. I tried ...
1
vote
4answers
2k views

I can not get my Realtek 8723 driver source compiled

I have a Lenovo IdeaPad Yoga 13. WLAN won't work out of box with fedora 18. So I googled around and found this 2 links: ...
-3
votes
2answers
220 views

Using file system call

I'm trying to learn system calls for open,write and close a file. I use this sample and the result is: gcc: error trying to exec 'cc1plus': execvp: No such file or directory Here's my program: ...
0
votes
1answer
148 views

Understanding a XINU system call - getstk.c [closed]

I am having trouble conceptually understanding what is going on towards the end of this system call, and why. I understand the getstk.c method returns the highest memory address of available space, ...
2
votes
2answers
276 views

Why read() is slower than getc()? [closed]

Why is read slower than getc? For example, this: for (;;) { chr++; amr=read(file1, &wc1, 1); amr2=read(file2, &wc2, 1); if (wc1 == wc2) { if ...
1
vote
2answers
329 views

Monitoring script started by rc.local

We have a C program which is started using rc.local´. We added a line like this: /usr/local/bin/pc to the rc.local file. pc is a compiled C program. Everything is working fine at the moment. What ...
0
votes
1answer
281 views

USB-Serial Driver(Exar Xr21v1414) Run Error

I'm currently trying to run the bellow driver in linux-3.8.3 on Exar xr21v1414 http://www.exar.com/connectivity/uart-and-bridging-solutions/usb-uarts/xr21v1410, but when i install the driver ...
1
vote
1answer
185 views

How to explicitly load shell interpreter in a C program

I want to create an executable script which is not readable/writable However since an interpreter needs to read this file it is not possible to do so directly. Therefore I wanted to know if I could ...
0
votes
1answer
64 views

Can a GTK applet widget be instantiated through dbus?

I just posted this: #274616: “Simple” gnome applets in Unity - stickynotes ... where I could instantiate a Gnome 2 bonobo applet in a standalone window, ... using ...
-1
votes
2answers
97 views

Why rsh not opens and reads PAM modules and limits.conf?

I am working on a project, that uses rsh utility for remote connection. But my project needs some extra features for that, so I add that features. Till now, all the things are going fine. But when I ...
3
votes
1answer
177 views

Make Completion Progress Script

Any time I'm executing a build process that takes several hours, I inevitably stare at my terminal and wonder, "how much longer?" Sometimes, I manually pick up on some pathname echoed to the terminal ...
-1
votes
3answers
427 views

telnet implementation using C [closed]

The program in general is I want to implement telnet program. On the client side user send its logging name and password, and if it is correct he starts to send commands to the server On the Server ...
0
votes
2answers
156 views

Which process updates /proc/scsi/scsi?

I wrote C that displays info about my hardware on ubuntu. Now I wonder how I can make it more flexible such as querying the hardware directly instead of the file the os updates. So I think I can look ...
1
vote
0answers
198 views

mod_rewrite: undefined symbol: lstat error

I compiled the mod rewrite for apache (version 1.3.0) however, when I try to run the server I have this error about mod_rewrite: Syntax error on line 27 of /home/myuser/apache/etc/httpd.conf: Cannot ...
3
votes
1answer
597 views

Send log messages to a different location

I want to send messages from C program and from Perl script to a file (for example, /var/log/my_log). I don't have access to the syslog daemon configuration, so I think in launch a differente syslog ...
-3
votes
2answers
88 views

Which Linux distro/mode offers lowest interference when running your own applications?

I'm interested in a Linux distro to build C projects and test their behavior in a very predictable and controlled environment. I'm especially concerned about letting the scheduler deal as much as ...
0
votes
1answer
117 views

Having trouble executing a compiled C program

I am running an Ubuntu v10.04 through VirtualBox. To test the persistence of files I create in the virtual machine, I wrote a very basic C program. When I shutdown the virtual machine and restart it, ...
2
votes
3answers
279 views

Linux GCC compiler options

I have recently started using Linux as a tool for programing. In my book, I have seen that the GCC is used with 2 options: -g and -o. Now, I know that -o is to set a filename, but what is the purpose ...
2
votes
1answer
416 views

Conky - string formatting

I have conky the record: ${color lightblue} Down: ${downspeed wlan0} Up: ${upspeed wlan0} Conky prints link speed, but the text moves: Down: OB Up: OB Down: 60B Up: 60B Down: 148B Up: 148B ...
0
votes
1answer
687 views

How do I write a login daemon?

There are many guides to the steps for correctly launching a daemon process, such as Stevens' chapter in Advanced Programming in the UNIX Environment. There is less agreement on what steps should be ...
1
vote
1answer
219 views

Linux kernel 3.2 syscalls

Just trying to get the assembler instructions for <__execve> of the code below because i want to build the shell spawn opcode list: #include <stdio.h> int main() { char *happy[2]; ...
2
votes
2answers
840 views

USB Driver Compilation Error

I'm currently trying to compile a Linux USB UART driver, which is provided here: http://www.exar.com/connectivity/uart-and-bridging-solutions/usb-uarts/xr21v1410 The driver consists of 2 header files ...
1
vote
1answer
87 views

How do I keep 'indent' from moving curly braces to the next line?

I have several empty inline function definitions in C++ like so: class C { void foo(){} void bar(){} }; now if I run indent -st -i4 -nut test.cc in order to just fix the indentation I get ...
2
votes
0answers
100 views

Command-line file reader (like “less”) that can tell the line where the user stopped reading

[Context] I'm developing a little app, as a hobby to learn ncurses, that catalogs and lists and searches within a set of documents (for now, they are the HOWTOs from TLDP). The most tricky part of ...
2
votes
2answers
2k views

Calculating total CPU system usage in C [closed]

I found this answer on StackOverflow for calculating total CPU usage: http://stackoverflow.com/questions/1420426/calculating-cpu-usage-of-a-process-in-linux/4497769#4497769 But how do I calculate ...
1
vote
1answer
310 views

Writing a service in C: How to pass and process arguments to running service?

I want to write a service in C. While this service is running in background and processing some information I need to grab the results from this service from other applications or from command line. ...
3
votes
1answer
296 views

IP_TRANSPARENT missing from glibc headers

I'm trying to use the IP_TRANSPARENT declaration. I am using debian 6.0.5. IP_TRANSPARENT is only defined in linux/in.h however it conflicts with netinet/in.h. In centos for example, IP_TRANSPARENT is ...
2
votes
2answers
2k views

How does copy-on-write in fork() handle multiple fork?

According to wikipedia (which could be wrong) When a fork() system call is issued, a copy of all the pages corresponding to the parent process is created, loaded into a separate memory location by ...
1
vote
0answers
156 views

Having problems with script and redirecting input to stdin [closed]

EDIT: found mistake, it was actually bug in my program, I had > instead of >= in my for loop that reads coefficients. I'm fairly new to linux, and I need help with bash scripting. I have C program, ...
3
votes
2answers
414 views

How to adjust time command to measure a program elapsed time

I'm trying to get the time that my program takes to finish (aka elapsed time) so I'm using the common time. What I get by doing this is 3 measurements: user, system and total. This is fine but I ...
0
votes
1answer
564 views

pcap and raw socket [closed]

I want to develop an application (module or user-level if possible) to create a raw socket in RHEL stealing all level-2 packets directly from kernel (without being routed or handled by other open ...
4
votes
1answer
1k views

Does free() unmap the memory of a process?

I am running a C program on Linux 2.6.16 kernel. I do not think there are memory leaks in my program however the memory consumption for the program remains stable after certain operations and does not ...
7
votes
2answers
4k views

How to compile a c program without leaving the editor? [duplicate]

I am using vim editor on Linux mint. I want to know if there is any way to compile c program without leaving the editor.
2
votes
4answers
498 views

/usr/bin/which returns cryptic error “which: no ls in ((null))”

I am writing a simple shell program. When I use /usr/bin/which with my shell in mac osx and ubuntu, it acts normally. When I use the exact same command on Red Hat Enterprise Linux Client release 6.3 ...
135
votes
4answers
50k views

Why is FreeBSD deprecating GCC in favor of Clang/LLVM?

So I was surfing the net and stumbled upon this article. It basically states that FreeBSD, starting from Version 10 and above will deprecate GCC in favor of Clang/LLVM. From what I have seen around ...
3
votes
1answer
478 views

Confused about ident

I inherited a bunch of files that begin with the following statement at the top Ident:/some/path/to/a/file Ident seems to be related to C coding and make files but I am not really sure. None of the ...
-2
votes
1answer
560 views

Difference Between #include “file.h” and #include <file.h> [closed]

What is the difference between the #include "file.h" and the #include <file.h>? Surely they mean the exact same thing, because I have a file that has something like this: #include ...
12
votes
2answers
2k views

Why can't I run this C program?

I'm trying to run my first "process" program, but I get the following error : ./fork.c: line 4: syntax error near unexpected token `(' ./fork.c: line 4: `int main()' I'm pretty sure that the code ...
4
votes
1answer
1k views

How to create a fake device file that accepts input from a C program?

I want to create a C program that accepts input from a joypad (/dev/input/js0), processes it, and then sends it to a fake device file (character or block) labeled as a keyboard (oh, and what is the ...
0
votes
1answer
180 views

Bash shell with problematic outcomes under Linux (C) [closed]

Following my previous post, I still have one annoying bug that won't leave . I wrote a simulator for the bash command under Linux. When I run my code in a single run, with the these commands: ls ...
0
votes
1answer
321 views

Redirecting output of program reading from stdin

When I want to redirect an output of a.out program I will use ./a.out > output.txt This doesn't work when the program reads something from stdin. How would you redirect output in this case? I ...