Questions tagged [c]

C is a general-purpose programming language

C (pronounced like the letter C) is a general-purpose computer programming language

490 questions
25
votes
6 answers

Source code formatter/indenter

I'm using Ubuntu 12.04. I do not have any root or sudo privileges as this is a company machine. Is there, in a normal installation of Ubuntu 12.04, any terminal program that I can use to turn ugly malformed source code that lacks any indentation…
user9993
  • 389
  • 1
  • 3
  • 6
18
votes
5 answers

How to compile a C program that uses pthread.h?

I'm a beginner and I'm new to Ubuntu. I just installed it and want to run a C program. I have no idea what platform to use or where to write the code. I need to use the pthread.h header file in the program. Can anyone help me?
user248075
  • 197
  • 1
  • 1
  • 3
5
votes
1 answer

How to to use gcc with LAPACK and external header file?

I am trying to run a C program that uses an external header file with LAPACK AND LBLAS libraries, every time when i try to run the program i get an error lapack not found, How do i properly use the libraries to run the program. ubu@sanjay-pc:~$…
kernel_panic
  • 11,732
3
votes
1 answer

How to implement the MSG_DONTWAIT on a recv call

I am implementing a server simulation program and want to check if anything was received via a recv from a TCP/IP socket witout waiting. When I place the MSG_DONTWAIT flag, recv returns a length of -1 and errno of "Resource temproarily anavialable".…
mjmeyer
  • 31
  • 1
  • 1
  • 2
2
votes
1 answer

how do i run main file which function is store in another file and also the header file too?

// mainheader.h int square(int b); // maiNfunction.c #include"mainheader.h" #include int square(int b) { int y; y= b*b; return (y); } //=====maiN.c file #include //#include #include
2
votes
1 answer

how to open a program generated binary file?

i have implemented a c program where raw packets are received from the network and saved in a binary file. Thing is i cant open that binary file. i tried opening it using terminal,but i am getting permission denied. I used sudo ./sniff_data.bin…
2
votes
1 answer

File formats with gcc

I wrote some c code in a file and saved it with gedit. I then opened the terminal and tried compiling it with gcc but it gives me an error that it does not recognize the format of my c file. What format does gcc read?
Isaac D.
  • 41
  • 1
  • 1
  • 3
1
vote
1 answer

LINUX and C : What does it mean this condition, and how to install the required packages in order to return true

Using linux ubuntu with metasploit framework, i have a shell script which contains the following lines in the first begining of the file. At first glance i thought that i should install the the mingw32 package, so i uses the following line in…
Rafik Bari
1
vote
2 answers

Are fcntl constants in Ubuntu different from other OS?

I found the problem with my fcntl implementation in js-ctypes. I was using the wrong constant values. Everywerhe I look though they have it different, For…
Noitidart
  • 417
1
vote
1 answer

Kindly explain me this code of increment decrement operator

Following is the code that I run in ubuntu 13.10. Code:- #include main() { int i=10,j=10; i=i++ + ++j; printf("i=%d j=%d\n",i,j); j=++i + j++; printf("i=%d j=%d\n",i,j); } Output:- …
Muskaan
  • 13
  • 3
0
votes
1 answer

The file descriptor is duplicated in the thread

My C source behaves strangely. I use Ubuntu 14.04 I use two pthread. And in each of pthread calls the open () and socket (). Oddly, this file descriptor is duplicated in certain cases. Why do these symptoms appear? [Source] #include…
DonBit
  • 129
  • 1
  • 9
0
votes
1 answer

error with .data file,C

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 I am using the 2014 version of Ubuntu…
0
votes
1 answer

Ubuntu Kernel Source Code for NAT Firewall

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 information that it can be done with the help of linux…
rbm
  • 1
0
votes
2 answers

Newbie C programming question

Can anyone explain why the output of this code is 2? I mistakenly thought it was 3. int array[] = {1, 2, 3}; int *address = array; array[0] = 2; array[1] = array[2]; array[2] = *address; printf("%d\n", array[2]); return 0;
jwhstman
  • 3
  • 2
0
votes
2 answers

Meaning of "netinet" in socket programming

What are the meanings of "netinet" and "in" in "#include " ?
1
2 3