Questions tagged [c]
C is a general-purpose programming language
487
questions
1
vote
1
answer
2k
views
Confused about how to compile modsecurity module for apache in Ubuntu 14
After I followed the instructions in Building Custom ModSecurity Modules section in modsecurity dev guide in order to compile mod_tfn_reverse.c using the command apxs -ca mod_tfn_reverse.c, I'm still ...
0
votes
1
answer
103
views
How do I change the final location of a compiled c program in the terminal
After a c program is compiled it is stored in ./a.out.
Is there any way in which I can change the file to any name I want?
0
votes
1
answer
189
views
How can I get my terminals / shells to have custom designs in it?
How can I add fun stuff to my terminal so I have extra zazz for when I break every thing every day! :D I'm learning C / C++ and think root projects and custom terminals would be fun way to practice ...
2
votes
0
answers
289
views
Can't call gnome-screenshot in C
I want to call the command gnome-screenshot -ac in my C program using system("gnome-screenshot -ac") or exec() but they didn't work. I'm sure that this command works well because I can use it in the ...
2
votes
0
answers
994
views
Where's device file of the sound card?How can I play by C
In /dev, I just find /dev/console, rather than /dev/dsp, /dev/audio, etc., which friends told me the device file of sound card in Linux.
Now, I want to play music and change the volume by C in Ubuntu ...
1
vote
1
answer
85
views
Help following instructions (stuck at editing a file)
I'm following these instructions. This is what I've done so far:
Installed JDK
Downloaded NDK & SDK, extracted them and MOVED them to usr/src
Configured my $PATH
Ran android and now I'm ...
0
votes
2
answers
2k
views
bash - can shellcode be made from a bash script?
I was thinking it can't, since there's not really a binary for bash scripts, but having to write a C program every time you need to generate shell code for a single command is just a pain.
2
votes
1
answer
2k
views
SNAP Installation C++
I am new to Linux and working in its environment.
I have trouble understanding and installing SNAP library for C++ on Ubuntu 14.04.
I am following this tutorial.
Inside the SNAP directory I run the ...
0
votes
2
answers
1k
views
gdb - load kernel module for remote debugging
Ubuntu 14.04 LTS:
peter@peterubuntu0:$ insmod mymodule
peter@peterubuntu0:/sys/module/mymodule/sections$ cat .text .data .bss
0x0000000000000000
0x0000000000000000
0x0000000000000000
So how do I ...
1
vote
1
answer
5k
views
How to open new terminal by C code?
I am using ubuntu 14.04 and Qtcreator to complile a code.
I am able to run a terminal by code system("/home/salman/find_location/start_yarp.sh");
But on the next line i have system("/home/salman/...
2
votes
0
answers
190
views
Debugging kernel running on AMD target from Intel host - how to return control to gdb?
I have compiled kernel 3.13.0-55 on Ubuntu on both AMD and Intel machines. I tried to copy compiled kernel to Intel target but it won't boot with that one. Therefore I have compiled the same version ...
0
votes
1
answer
102
views
error with .data file,C [closed]
I have been trying to compile a C program that receives data from a .data file.Unfortunately,I always get the following message:
input.dat.2:1:error: expected identifier or "(" before numeric constant
...
1
vote
1
answer
57
views
How to debug a process developed in C running as a Wi-Fi Access Point?
I have two processes developed in C. The first one is running as a WiFi Access Point in Ubuntu machine and the second is running as a controller in another Ubuntu machine in the ethernet network. This ...
0
votes
1
answer
701
views
Is it possible to send keys to inactive window via any c/c++ library?
I'm developing a program where I need to control an inactive window by sending a couple of keys. I was wondering if there is any c/c++ library to do so on Ubuntu (and linux in general) ? I googled a ...
0
votes
2
answers
1k
views
Difference between C programs and shell scripts receiving signals from fuser
I have written the shell script below for a lab in my college. It must look at a log file being upgraded frequently from another process and create a number of copies passed at invokation.
Here is the ...
11
votes
1
answer
2k
views
Does Ubuntu automatically release memory allocated by a C program as the program terminates?
I have written a C program containing code allocating memory using the malloc() function. If I don't free up the memory using the free() function, will Ubuntu release it automatically?
1
vote
1
answer
1k
views
How to install a custom library written in C?
I want to install Stanford Portable Library on my system (Ubuntu 14.04). Can anyone please instruct me how to do it?
3
votes
2
answers
1k
views
Ubuntu Terminal: C program (or other solutions) to kill processes running on a specific port and start xampp [closed]
Can anyone help me? The program's objective is to kill the processes running on port 443 and to then start xampp automatically.
What I've done:
#include <stdio.h>
#include <stdlib.h>
...
7
votes
1
answer
1k
views
How to log bash history by editing bash source?
I'm using bash-4.3.30. I need to log all my commands history on a single file. I can do that by editing the bashrc or bash_profile but I'm not going to do that.
I want to play with bash source files....
4
votes
1
answer
4k
views
How to compile programs that use term.h?
I try to compile the code below:
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <term.h>
//#include "/usr/include/term.h"
void clear_screen(void) {
...
1
vote
1
answer
418
views
Abnormal behaviour of malloc() fuction?
I was playing around with alloc functions in my Ubuntu 14.04 64-bit, gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1) and found that malloc returns memory with initializing it to zero. Which is quite weird ...
0
votes
1
answer
60
views
Install Ubuntu on Drive C Only
How do I install Ubuntu on Drive C only?
I backed up all my data on Drive D and I'm afraid that I might lose them all.
1
vote
2
answers
23k
views
GCC Fatal Error
everyone
Here's my problem; So, I'm new to Ubuntu and programming and I just wanted to start with C. I created the classic "hello.c" file
#include <stdio.h>
main ()
{
printf("Hello ...
0
votes
1
answer
902
views
Ubuntu Kernel Source Code for NAT Firewall [closed]
In TCP Communication, when the packet is being transferred from ethernet to network(IP) layer, I want to print the data present in that packet?
I am working on linux (ununtu 14.04).
I got some ...
4
votes
1
answer
10k
views
Location of USB header files for Include
I'm working on porting a Windows application to Ubuntu 14.04. The application is a host-side GUI for a USB device that uses the generic HID interface. I need to Include the header files for the ...
1
vote
1
answer
4k
views
How to run C program on 14.04?
I'm trying to run some C programs using Geany and Code::Blocks. After coding them, when I run them, a message is showed in the terminal like this:
In Code::Blocks:
sh: 1: /home/c program files/2: ...
2
votes
1
answer
2k
views
Can't compile tiny C code which uses librsvg
I am almost complete noob in linux world and I use Ubuntu 14.04 LTS with gnome-session-fallback (compiz) under VirtualBox on Windows 8.1 machine. My goal is to use this library:
https://github.com/...
2
votes
1
answer
5k
views
Compiling C code in the terminal
I've been having a problem with compiling.
I used the following test C code below and saved it as test.c in Home folder.
#include <stdio.h>
int main()
{
printf("Bruh!");
return 0;
}
When ...
2
votes
0
answers
3k
views
Undefined reference error while using custom system call in kernel 3.19
I'm trying to import new system call in the kernel 3.19. I've followed the tutorial given here!
This is my simple code to implement factorial calculation via system call.
#include <linux/kernel....
1
vote
1
answer
8k
views
How do I handle a "No such file or directory" error for a header file from make?
When compiling a source package, I got an error from make that looked like:
In file included from foo.c:28:0:
bar.h:23:18: fatal error: bar.h: No such file or directory
#include <bar.h>
...
0
votes
1
answer
226
views
Geany no support greek language
I am using Geany for C programming.
My code contains some greek sentences,I set the Default Encoding to GREEK(ISO-8859-7), but when I try to execute the program the greek letters show up like this.
...
15
votes
2
answers
37k
views
Python.h found by locate but not by GCC
I just wrote a simple C executable to check if Python.h is working or not
#include<Python.h>
#include<stdio.h>
int main()
{
printf("this is a python header file included programm\n");
...
0
votes
1
answer
295
views
Any c functions to simulate double click on file?
I have some .desktop files and am looking for c functions that make it as if user double clicked on the .desktop files.
Here are my desktop files: https://www.youtube.com/watch?v=Yc19BzLTnDE
Thanks
5
votes
2
answers
950
views
C Using Libraries Without IDE [closed]
This may be a stupid question. How do you use C libraries without an IDE? I want to only use a text editor.
0
votes
1
answer
4k
views
Ubuntu: "X" mark on the top-right corner of respective file icons
I am new to ubuntu/ linux. Hence, please accept my apology for asking very trivial questions. Also, I googled; but, did not find suitable answer.
I installed a third party lib: Taucs (location on my ...
1
vote
1
answer
698
views
Where are the headers with IOCTL numbers for ext4?
I am looking for ext4.h, or another file that contains EXT4_IOC_*. There is nothing in /usr/include or /usr/src. I have linux-headers-generic installed. I am on Kubuntu 14.10. Where are the headers?
...
0
votes
1
answer
9k
views
fatal error: linux/err.h: No such file or directory [duplicate]
What package should install for this header (err.h) is available?
I need this library (linux/err.h) to compile a proprietary driver (kernel module) in Ubuntu 14.04 Server/Desktop 64bits
13
votes
2
answers
42k
views
Where are header files for GCC located?
I want to manually add some header files like math.h and graphic.h for gcc but don't know where to put them.
3
votes
1
answer
11k
views
Lightweight C/C++ editor with code completion and debugging
Ever since the debugger plugin for geany stopped working (see below), I am looking for an editor for C/C++ source files with the following features:
Code completion (i.e., Intellisense-like ...
1
vote
0
answers
316
views
Fullscreen Detection Algorithm for lockscreen/screensaver
I'm working on a cross linux fullscreen detection algorithm, for use in detecting lock screen and screensaver.
This is what I have so far:
Check if _NET_WM_STATE_FULLSCREEN is supported, if it is ...
0
votes
1
answer
5k
views
Using mysql in C programming [closed]
I installed ubuntu on a virtual machine.There,I installed mysql server(sudo apt-get install mysql-server) .This worked, because I could acces mysql-u root -p password. After that,I did : sudo apt-get ...
2
votes
1
answer
3k
views
Gnuplot - Save result
I create a graph that changes each second using gnuplot.Now, I want to save this graph as gif or png file when my program finishes. How can I do? My C code is below
FILE *pipe = popen("gnuplot -...
2
votes
1
answer
261
views
GNU C - Signals never arrive to the handler
I'm working on a university project which needs to be written in GNU C and run on Ubuntu server. My primary OS at home is Ubuntu 14.04 on my PC. The project is about multi thread programming and I ...
1
vote
1
answer
2k
views
How do I open C libraries and functions implementations?
I am having a problem that I cannot browse the header files /libraries to get the implementation of the C functions like mssget, msgsnd, shmat etc.
How should I open these files?
2
votes
1
answer
762
views
Not able to include sqlite3 in c program
I installed libsqlite3-dev from ubuntu software center and after the installation, i found the sqlite3.h file in usr/include folder. There was no error in including that header file, but i am not able ...
-3
votes
1
answer
2k
views
C programming questions (newbie) [closed]
I read Kernighan & Ritchie C programming book now and have a few questions about 'getchar' and 'putchar'.
The question is below the code example:
#include <stdio.h>
int main(void) {
...
0
votes
1
answer
183
views
Which compiler i have to use to understand C behaviour exact behaviour
I am confused regarding with the c compilers. as per my knowledge for a programmer the code is not important but the internal behaviour is very important.cause if we know how the compiler behaves for ...
8
votes
2
answers
66k
views
No such file or directory #include <string> [closed]
I wrote the program kai.c and now am trying to compile it with gcc kai.c -o kai, which returns:
kai.c:5:18: fatal error: string: No such file or directory
#include <string>
^
...
4
votes
1
answer
2k
views
Sending different kill signals to init - how to log
I have to write a C program to check how init reacts to different kill signals, however I am not sure how to log it - for example signal number 14 crashes the ubuntu, then some higher one turns it off....
0
votes
1
answer
2k
views
FT_Read is not working properly [closed]
I am writing code for serial programming for serial communication between FTDI device and Desktop through XBEE.
I am writing command on device for (in example) reading Battery Voltage Current and ...