Questions tagged [c]

C is a general-purpose programming language

Filter by
Sorted by
Tagged with
1
vote
1answer
37 views

Unable to run program on Linux target

I am working on Ubuntu 20.04. I made a simple program (Hello World), and a makefile for it on my laptop and run it (./Simple), and everything worked. Then I included the program (Simple.c) in the ...
-1
votes
1answer
36 views

trying to install GCC [duplicate]

I would like to install gcc compiler by this command apt install build-essential and after pressing Yes, it asks me to insert some media. Media change: please insert the disc labeled 'Ubuntu 18.04....
0
votes
0answers
151 views

Mimic deluser command in linux

To delete a user without deluser in linux we have to do these things Remove user from etc/passwd Remove user from etc/shadow Remove user's directory from /home/ (I used sudo rm -rf /home/username) I ...
0
votes
2answers
23 views

Passing control characters to c program

i'm trying to pass my string with special characters, but somehow my program recognize them too literally. Here is my program. int main(int argc, char *argv[]) { char *str; char *trim; ...
0
votes
0answers
17 views

How to create and run your own file-type in Ubuntu using C language?

I am currently working on a project in which I am thinking of making my own file extension like .something and making a program to run and read that file (like a NotePad), but I have no idea how to do ...
0
votes
1answer
41 views

shell unnanme -r command not found [closed]

shantanu@LAPTOP-3NM82R8U:~/c$ make make: unname-r: Command not found make -C/lib/modules//build M=/home/shantanu/cmodules make[1]: *** /lib/modules//build: No such file or directory. Stop. Makefile:3:...
1
vote
0answers
22 views

How to get 256 colors working in ncurses program

I am trying to run Listing 3-5 in the book Programmer’s Guide to NCurses by Dan Gookin (page 41). #include <ncurses.h> #define NEW_COLOR 1 #define RED 0 #define GREEN 750 #define BLUE 750 int ...
0
votes
1answer
54 views

Error missing binary operator while preprocessor compiling C program

I tried upgrade to Ubuntu 18.04 and compile a simple C program from the terminal with gcc -o test test.c. #include <stdio.h> void main() { printf("h\n"); } but it threw a missing binary ...
0
votes
0answers
14 views

Makefile Error pl-0 Compiler

i got a problem with my makefile an a really dont no why. So i had to programm an pl-0 compiler in c / c++. So the scanner and the parser is generatet with flex and bison but now i cant compile it. ...
0
votes
0answers
22 views

writing to another tty doesn't get prompt back

I have a program written in c that writes 'hello another tty' to another terminal. #include <stdio.h> int main(void){ FILE *fp; fp = fopen("/dev/pts/4", "w"); fprintf(fp, "Hello, another ...
0
votes
0answers
85 views

error: C compiler cannot create executables

I am trying to install netcdf in order to compiling WRF. However, it shows an error which I do not understand. and config.log: This file contains any messages produced by compilers while running ...
0
votes
1answer
51 views

What is the difference between giving input by typing from keyboard and by redirecting? [closed]

I've got a short, easy to understand piece of code: #include <stdio.h> #include <unistd.h> int main(){ char buff[0x10]; read(STDIN_FILENO, buff, 0x10); int result = write(...
1
vote
1answer
72 views

Playing an audio with cron jobs

I am trying to add a new command to my own shell such as: alarm 7.15 music.wav I want to create a cron job so it can schedule alarm daily at given time. So, I create a file for each call of alarm, ...
-1
votes
2answers
194 views

(First C Program / Hello World) Keep getting Syntax Error

This is my C code: #include <stdio.h> void print_hello() { printf("Hello n10321234, welcome to BSB211"); } int main() { print_hello(); return 0; } However, I keep getting the ...
0
votes
0answers
39 views

Linux Event capturing using C program

I want to capture the linux kernel events for usb device connection/disconnection (both mass storage and serial device). In case of mass storage device with connection status, program should get ...
0
votes
0answers
13 views

What happens to a packet after XDP_DROP?

Consider the following BPF code attached to the XDP hook point. int xdp_pass_func(struct xdp_md *ctx){ return XDP_DROP; } It is sure that the packets are dropped, but what I am interested in is:...
1
vote
0answers
39 views

Unloading a Kernel Module

I was working on an assignment for Kernel programming, where I ran into a NULL pointer issue: [25543.418530] BUG: unable to handle kernel NULL pointer dereference at 00000008 [25543.418533] IP: [<...
1
vote
0answers
25 views

how to get start with C, C++ coding in unix, and what is the basic packeges needed to install at first? [duplicate]

I am a beginner to use linux os. What is the basic packges needed to install to compile a C,C++ code in terminal box ? and, please give the command to install it . :(
0
votes
0answers
41 views

Compiling file.c and creating executable file with one button - Ubuntu 19.10 [duplicate]

I'm wondering if there is a way (e.g. a software like bloodshed dev c++ in Windows) to compile a file.c and to create the executable file by using a single click. I know only the classic way: writing ...
0
votes
0answers
63 views

How to set file to immutable for all user (Root user also) and no one can modify (Root User also)

I am trying make a immutable file that is anyone can read only and can't do any modification into it. i.e - No one can write into it or delete it or move it. For this is referred chattr this LINUX ...
0
votes
0answers
22 views

How to get file path VS project on Ubuntu?

I have a C project. I am working in VisualStudio on Ubuntu. I need to read from file I have such a method fp = fopen("path_to_file", "r"); if (fp == NULL) { ...
0
votes
1answer
794 views

I need a lightweight IDE for C coding, for Lubuntu

I have no clue about linux, i've used Windows all my life. I recently installed Lubuntu to a really old laptop i had no use of. I need to install a lightweigh IDE for C coding to use for my university ...
0
votes
1answer
328 views

Permission Denied: System calls in c

I am attempting to code and execute bash scripts using C lang. Purpose is for a personal project I'm writing in C, and seeing if I can include bash capabilities as well. I created a simple C file ...
0
votes
1answer
80 views

I want to copy my present working directory location into abc.text file by replacing some sentence

I want to copy my present working directory location into abc.text file by replacing some sentence. For example, 4th line of abc.text is "my name is narender" and i want replace pwd path instead of "...
2
votes
0answers
226 views

Compiling a LibUSB 0.1 program fails with “undefined reference” errors

I have a small C program that uses libusb 0.1. I've already installed libusb-dev (which basically means libusb 0.1: https://packages.ubuntu.com/de/xenial/libusb-dev) and included the header <usb.h&...
2
votes
2answers
81 views

Why doesn't system() work when called in a loop with cd and rm commands?

I started using Linux recently, so my program is just for learning. Having said that, here's my code: #include <stdio.h> #include <stdlib.h> int main () { FILE *fin; char buf[200]; fin ...
1
vote
0answers
22 views

Can't run C on Geany [duplicate]

I'm having trouble in running C code from Geany. The code compiles successfully, but when I try to execute it, it shows on Terminal: /tmp/geany_run_script_I007A0.sh: 7: /tmp/geany_run_script_I007A0....
1
vote
1answer
235 views

how can i use kbhit() function while using gcc compiler,as it does not contains conio.h file?

GCC compiler does not contains file but i have to use kbhit() function to make a program, what can i do ? is there any substitution of it?
0
votes
0answers
140 views

Need help configuring meson/ninja for cross compile

I'm trying to cross-compile a gstreamer application. the template I have uses meson and ninja to build and compile it. top folder meson: project('gst-template', 'c', version : '1.17.0.1', license : '...
2
votes
0answers
25 views

Correct struct stat for my installation

As a learning exercise, I'm calling ftw using .NET Core interop from C#. It works fine insofar as I receive appropriate filenames in my callback. However, I haven't defined struct stat correctly. ...
0
votes
1answer
94 views

sleep(int) code isn't executed in right order in C programing [closed]

I have some codes in my program. I'm trying to run Loading screen in Terminal by using sleep(int) in a for loop below but it doesn't do in the right order. These are my codes: void LOAD() { ...
2
votes
1answer
93 views

How to restrict one CPU core per one BPF code

I am trying to attach BPF at XDP hook points for each NIC on my system ( I have 3 NICs). I was successful in reducing the number of CPUs from 8 to 3 using maxcpus=3 as a boot parameter in /etc/...
0
votes
0answers
101 views

link libpcap to android cross compile project

I have installed libpcap using sudo apt-get install libpcap-dev libpq-dev and trying to cross compile a C project with Android NDK and I'm getting an error: fatal error: 'pcap.h' file not found ...
3
votes
1answer
1k views

libssh undefined reference error

I am trying to build the ssh connection example and getting undefined references: /tmp/ccb7VC9w.o: In function `verify_knownhost': sshtest.c:(.text+0x3a): undefined reference to `...
0
votes
1answer
77 views

libssh example file - exec formate error

I followed the ssh guide to create a ssh connection and after compiling... The execution of the file doesn't run. The error I get is: ./sshtest bash: ./sshtest: cannot execute binary file: Exec ...
1
vote
0answers
19 views

Does execve reset GP registers?

Does execve() or any of its sister functions reset the general-purpose registers? In other words, if the caller stores some values in all or some GPRs, will the new program see the same values in the ...
0
votes
0answers
221 views

configure: error: linking to Fortran libraries from C fails

I am following this tutorial to install the mentioned software (called PRESTO), but when I type ./configure, I receive the following message: checking how to get verbose linking output from /home/...
0
votes
0answers
47 views

Whats the difference between 0> and > redirections?

I cant redirect the output of a particular program using > , but it works if i use 0> , e.g ./foo > ouput.txt ./foo 0> output.txt this program writes to the standard using the C ...
0
votes
1answer
326 views

iPerf :WARNING: did not receive ack of last datagram after 10 tries

client side: iperf -c 10.0.1.5 -u Client connecting to 10.0.1.5, UDP port 5001 Sending 1470 byte datagrams, IPG target: 11215.21 us UDP buffer size: 9.00 KByte (default) [ 28] local 10.0.1.2 port ...
1
vote
1answer
47 views

How to send packets at 512 nano sec delay using Socket Programming and UDP socket

Using SOCK_DGRAM for UDP sockets All packets are 22 bytes in length (ie 64 including headers) client.c ... no_of_packets--; sprintf(buf, "#:!0 rem"); sprintf(buf, format , buf); ...
0
votes
0answers
46 views

File Read/Write operation on a file in a kernel function,i.e., handle_ept_violation() in vmx.c?

I am trying to write/read page faulted physical addresses to a file in a kernel (v5.3-1) function, i.e., handle_ept_violation() which is present in vmx.c. I have followed this, it's working as a ...
0
votes
1answer
189 views

How can I compile full project C language [closed]

I am currently using ubuntu 18.10 and i want to compile the source of this project but i dont know how The author says I should use Microsoft Visual Studio, Is there any way to compile these files in ...
1
vote
0answers
56 views

bpftool: unable to understand lpm_trie keys

I am entering the following commands: $ sudo bpftool map create /sys/fs/bpf/routes type lpm_trie key 6\ value 1 entries 256 name routes flags 1 $ sudo bpftool map update id 194 key 8 0 0 0 0 10 ...
0
votes
0answers
50 views

GtkProgressBar pulsing broken in Ubuntu 18.04?

I have already asked this question on Stack Overflow and have not received a response, so I figured I would try my luck here instead: I have a GTK application that depends on pulsing a GtkProgressBar ...
0
votes
1answer
55 views

Getting inappropriate output in terminal

I have written a C program in Vim and trying to open the file by command vim filename.c I am getting this output. E325: ATTENTION Found a swap file by the name ".linklist.c.swp" owned by: ...
1
vote
2answers
353 views

How to modify build rules in Makefile

I tried to compile FFmpeg from source code located HERE. All is good, but the built binaries lack ffplay. And looks like the build rule is missing from the makefile located under /fftools. How can I ...
0
votes
1answer
905 views

Strange error in running CPP file [duplicate]

I created a very simple file in CPP, namely trash.cpp. Ran it using gcc trash.cpp #include <iostream> #include <string> int main() { try{ throw 6; } catch(int e) { ...
0
votes
0answers
179 views

TLS definition in libc.so.6 section .tbss mismatches non-TLS definition

errno: TLS definition in /lib/x86_64-linux-gnu/libc.so.6 section .tbss mismatches non-TLS definition in ../../../../dc_tools/libs/ghs_math_lib/libghs_math.so section .bss /lib/x86_64-linux-gnu/libc.so....
0
votes
0answers
58 views

Encountered “stdio.h: no such file or directory” while compiling a C source code [duplicate]

I am trying to compile a C program but a fatal error pops up always. I've tried various ways to solve the issue but it is still unsolved. Error I am facing:
2
votes
1answer
176 views

Read GPIO-ports from C-program

Iḿ trying the following: - we have a AXIS-controler which is connected to the Linux (18.04) via an CP2102-chip to an USB-port. We want to read the values of the GPIO 0-3-bits via a C-program on the ...

1
2 3 4 5
9