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.
1
vote
1answer
44 views
Syntax error: “(” unexpected when execute a compiled c program
I'm newbie in linux/script/command/etc...
I try to execute the c binary file acqv program in the Shell (this program has been compiled like this on another computer :
gcc acqv170104.c -o acqv `...
0
votes
0answers
21 views
Linux- C program [migrated]
I have recently(yesterday) started trying to learn linux and to program in this os. Now, one interesting and probably easy problem I came across while surfing the net was something like this:
...
0
votes
0answers
13 views
Why there is still a race condition even though I call sigsuspend()? [migrated]
This is the coursework of my class. I'm not sure whether my answer is correct or not. Can someone give me any instruction. In the first question, I can't figure out why there is a race condition, is ...
0
votes
2answers
40 views
Sending signal SIGINT to process while executing system call or script by killall -SIGINT [closed]
I want to send SIGINT to all processes by name so I am using killall -SIGINT which was working fine. Now I introduced system() call in my c code to run a shell script or shell command which take ...
-2
votes
0answers
14 views
c++ and Linux go together - why are there no questions in this section? [migrated]
C is the programming language Linux was originally written in. I learned C many years ago, but haven't used it since college. (I'm an EE degree, computers were necessary, but programming was left ...
1
vote
2answers
46 views
Errors while compiling C code [closed]
I have found piece of C code which would be very useful for what I want do to under this link: All possible combinations of characters and numbers
#include <stdio.h>
//global variables and ...
0
votes
0answers
8 views
How to increase net.core.rmem_max value from c code [migrated]
I tried to increase the value SO_RCVBUF by getsockopt(udp_fd, SOL_SOCKET, SO_RCVBUF, &rcvBufferSize, &sockOptSize) but I am not able to increase it more than rmem_max value.
So please tell me ...
1
vote
2answers
50 views
What is the advantage of archiving C object files in a static library (.a file)?
I mean, as opposed to just linking to individual modules/object files. Why are groups of modules archived together? Doesn't it make the executable 1. larger, and 2. less secure (i.e. more vulnerable ...
0
votes
1answer
61 views
fatal error: mcrypt.h: No such file or directory
I am trying to cross compile a C code which uses a header file mcrypt.h.
I am compiling my code in Ubuntu distribution and my target is an openwrt distribution. I am getting the below error while ...
0
votes
2answers
50 views
Restore original string.h after accidental overwrite [closed]
I was reading the header files for c and by accident, i changed something (i deleted some stuff by accident) I closed out of sublime text editor, expecting it to ask me to save, but it saved ...
0
votes
0answers
15 views
ENOMEM when calling sbrk() for 8GB
I am running Fedora 24 with linux kernel v4.7.3 on a virtual machine using VMWare Fusion v8.1.1. I am trying to write a c program where I make a call to sbrk() as shown in the code:
void *pool;
void ...
0
votes
2answers
50 views
Can't run the exe file [closed]
[I'm new to Linux, sorry]
So I have a code (.c file). And used the following command;
#!/bin/bash
#
gcc file.c -o file.exe
#./file.exe
So when I try to run the .exe file (using Wine) I get an ...
1
vote
1answer
27 views
How to see which files a Makefile uses?
I have the following makefile which is supposed to build procdriver.c and thus output a .ko file. The issue is that even when I delete procdriver.c my makefile seems to be able to build a procdriver....
3
votes
0answers
61 views
C on Linux: Running 25 parallel processes is significantly quicker than running 24
My C-program uses fork() to create new processes and I measure the time it takes for each one of these processes to do its work. In fact, I let them do the work 10000 times and measure that time.
...
1
vote
1answer
81 views
How can I create my own custom progress bar in Conky?
I have started using Conky some days ago, and I'm willing to create my own configuration. I have added some colors, cool ASCII art and learned the basics.
However, I don't like the default progress ...
0
votes
1answer
34 views
How to get the REAL gcc (not the one that is hashed to clang) in MacOS?
I am trying to compile a program that uses the OpenSSL library. I had a problem where it couldn't find the header files. I fixed this problem by adding the option -I /usr/local/opt/openssl/include ...
3
votes
1answer
112 views
du command showing different results than st_blocks
I'm implementing du -a in C and I'm using the stat function for this. The problem is that what I get from using st_blocks is 2× what I get when I use the command itself, does this make any sense? or ...
0
votes
1answer
29 views
Automate list files with ssh from Ubuntu to Windows(Openssh)
I am writing some automation API in C working with remote file system via SSH.
The host is running Ubuntu-Linux and one of the target machine is running Windows 7 with OpenSSH installed.
The ...
1
vote
1answer
20 views
Entering ascii chars as program input
If I write a very simple C terminal program that takes an input, how can I enter an ascii character as the input, like for instance the backspace character?
0
votes
1answer
36 views
Why is directing stdout to a file inconsistent and delayed? [duplicate]
I have tried two methods to direct the output of a program's printf calls to a file. In both cases, sometimes the file is updated immediately, sometimes it takes several minutes, and sometimes it ...
1
vote
0answers
16 views
some characters show after put objects on amazon s3
I use libcurl to put objects on amazon s3 service. Here is my original contents in a.txt:
aaaaaaaaaaaaaaaaaaaaaaaaaaa
bbbbbbbbbbbbbbbbbbbbbbbbbbb
...
0
votes
0answers
12 views
Where is struct blkid_struct_dev defined?
blkid.h typedefs as follows:
typedef struct blkid_struct_dev *blkid_dev;
That is the only appearance of the token blkid_struct_dev in blkid.h.
grep -rl blkid_struct_dev /usr/include
returns only /...
0
votes
0answers
57 views
Emscripten fundamentally incompatable with clang on linux
Question
Hello friends.
Last night I lost my mind.
A long time ago I wrote a really crude and primitive shell in C++, and I only
just recently discovered asm.js, so I thought it'd be neat to try to ...
2
votes
1answer
127 views
Java equivalent of strace
When I have an issue with a C application, one of the first tools I reach for is strace, I can easily see e.g. if it is blocking on a read from a socket, or for some file I/O or whatever else. But ...
4
votes
2answers
137 views
How to view Core file (general)
Scenario (Ubuntu 16.04):
I compile and run a C program (with -g, I get the traditional Segmentation Fault (core dumped), and then (of course) there is no mythical "core" file to be found. Some ...
93
votes
10answers
9k views
Why does argv include the program name?
Typical Unix/Linux programs accept the command line inputs as an argument count (int argc) and an argument vector (char *argv[]). The first element of argv is the program name - followed by the actual ...
0
votes
0answers
58 views
LFS 7.10 - why am I getting an error when using make command for expect-5.45
I am trying to compile expect-5.45 for LFS everything works until I use the make command, below is the output of using the make command:
gcc -DPACKAGE_NAME=\"expect\" -DPACKAGE_TARNAME=\"expect\" -...
2
votes
1answer
70 views
I want to participate in linux kernel development, where can i find some what is needed to do? [closed]
I want to participate in linux kernel development but i don't have idea what, in technically meaning i can do (i am looking for tasks). I am experienced C programmer, i know some linux kernel, i have ...
1
vote
2answers
107 views
Writing a Unix shell script to call a C function and redirecting data to a .txt file
I am new to Shell scripting. I wish to write a Unix script which will call a C program for N= 2^{i}, i= 1,2 ....20; and later record this data in a file.
(This program calculates definite integral ...
0
votes
1answer
44 views
When writing a file, permissions are write only
I opened a file in C and wrote it with this code:
int fd = open("soandso.txt", O_RDWR | O_CREAT);
write(fd, buf_of_data, 3);
The file now has write permission only for me and that is not what I ...
-2
votes
1answer
31 views
What is the reason to quote executable code with `…'? [duplicate]
I was reading through the original bourne shell signal handling implementation and noticed an expression inside a comment was quoted this way:
/* `stakbot' is preserved by this routine */
^^^^^^^^
...
-2
votes
1answer
52 views
C compiler while installing GCC!
I have a virtual machine running RHEL7. I am trying to install GCC from source following
https://gcc.gnu.org/wiki/InstallingGCC
I am unable to do
yum groupinstall "Development Tools"
or
yum ...
2
votes
2answers
160 views
Which is faster – C or shell scripting – and why?
I was looking for a detailed info (if possible some statistics) about which is faster to run, C or a shell script. And also I would like to know the reasons for the answer.
P.S. This is not a ...
0
votes
1answer
46 views
Syscall to delay execution of a signal handler?
Is there a function or syscall with wich we can delay execution of a signal handler. Meaning that the signal handler will not be executed at the delivery of the signal, but after some other code being ...
0
votes
1answer
20 views
Duplication of a file descriptor associated with an fcntl lock?
According to the man page of dup2, this syscall make a new copy of the old file descriptor. The two descriptors do not share (the close-on-exec flag).
However in case the file descriptor we are ...
0
votes
1answer
61 views
how to link against only the last shared library [closed]
My shared library libnew.so uses some symbols form an already built third-party shared library libold.so. I would like to build an executable binary file that should be only linked against libnew.so. ...
-1
votes
2answers
148 views
How to deal with C makefiles under the “Unix as IDE” philosophy?
I've been for long using VIM as my main editor and never touched an IDE since. This works great for most of the programming languages on the market. When it comes to C, though, I still fell limited to ...
-1
votes
1answer
77 views
segmentation fault core dumped in c [closed]
When I run this code I get the error segmentation fault (core dumped)
#include<stdio.h>
int main(int argc, char *argv[]) {
int i = 0;
printf("\n cmdline arg counts = %s ", argc);
printf("\...
0
votes
2answers
55 views
Intel C compiler doesn't work with sudo
I can compile using icc just fine:
akady@TermintX ~/Test $ icc HelloWorld.c
akady@TermintX ~/Test $ ls
a.out HelloWorld.c
akady@TermintX ~/Test $ ./a.out
Hello World
But ...
3
votes
2answers
56 views
IFS variable ignored in system()
For a class at my university I am trying to achieve a privilege escalation. I have this simple code that simply replicates the output of ls and has SUID bit set.
int main(void){
system("/bin/ls");
...
1
vote
2answers
128 views
How to debuild (Debian) Apache without it performing a clean
I am trying to edit an Apache module on Debian (strictly, I'm doing this on Raspbian Jessie-Lite), and am broadly following the Debian build instructions:
$ mkdir -p ~/src/debian; cd ~/src/debian
$ ...
1
vote
1answer
105 views
crc8 undefined while compiling linux kernel module on Beaglebone black/Debian
I am trying to use the device driver for a TI battery monitor BQ76PL536 on my beaglebone black(BBB). The driver code is located here: https://github.com/tommessick/bq76pl536 .
Although, the author ...
0
votes
1answer
125 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 ...
2
votes
2answers
66 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
1answer
44 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
2answers
80 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 is ...
4
votes
1answer
48 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 ...
2
votes
1answer
227 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
36 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 ...
6
votes
2answers
112 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 ...