Questions tagged [c]

C is a general-purpose computer programming language used for operating systems, games and other high performance work and is clearly distinct from C++. Questions about programming in C are off topic and will be closed or migrated. Consider asking your question at Stack Overflow instead.

305 questions
259
votes
8 answers

What do the parentheses and number after a Unix command or C function mean?

I keep seeing parentheses and a number after a command in Unix or Linux or C function. For example: man(8), ftok(2), mount(8), etc. What do these mean? I see them in man too.
Malfist
  • 3,119
46
votes
4 answers

How do I install a Windows program (written in C) downloaded from GitHub?

I've downloaded a dead simple Windows program from GitHub (this if it's relevant). I downloaded it as a ZIP file, but I can't figure out how to install it. It's written in C, I think. Do I need a compiler? (Visual Studio?) Is there something simple…
36
votes
3 answers

Syntax highlighting in Microsoft Office Word

Possible Duplicate: How do I easily highlight the syntax of PHP code in Word? I need to paste some code (ANSI C) in Microsoft Office Word, and I need some form of syntax highlighting (instead of simply changing the font to Lucida Console) Is…
17
votes
6 answers

"bin/sh: can't access tty; job control turned off” error when running shellcode"

I'm writing shellcode to exploit a buffer overflow vulnerability on a server. To do so I have port binding shellcode that I send to the server and then I run (from a linux terminal) the command telnet serverAdress 4444 where 4444 is the port which I…
Nosrettap
  • 1,041
15
votes
2 answers

How to stop and detect the fork bomb

#include #include int main() { while(1) fork(); } This is the code for a fork bomb. In our college, we connect via telnet i.e client serving protocol. Some 100 systems are connected to server. Suddenly we saw the…
Rajesh M
  • 253
15
votes
1 answer

emacs -- C/C++ jump to beginning of containing block

While editing C or C++ files in emacs, I'd like to be able to go to the beginning of the containing block of code. I was expecting to find a c-beginning-of-block function, but alas, no such function exists (to my knowledge). For example, I might be…
mgalgs
  • 2,472
14
votes
3 answers

Compiling C files on Ubuntu and using the executable on Windows

For some odd reason, make kept giving me tabulation errors when compiling on Windows, so I tried it on Ubuntu and it worked just fine. Now I would like to use the executable I got from compiling on Ubuntu and use it on Windows. However, the file…
hkj447
  • 261
13
votes
2 answers

Where's the man page for the `sizeof` C function?

How come there's no man page for the sizeof C function? $ man 3 sizeof No manual entry for sizeof in section 3 $ man sizeof No manual entry for sizeof I do see man pages for other C functions like malloc if I run man 3 malloc and similar commands,…
13
votes
1 answer

How does the OS tell whether an "Address is already in use"?

If my C program uses sockets, binds to localhost:9025, exchanges some data, gets manually killed and restarted, it sometimes crashes with the error being: Address already in use. All SE-recommended software that I've tried to look for “pid that…
12
votes
3 answers

In GDB, how can I jump directly up to the topmost call stack frame?

I have a C program that seg faults after descending deep into an infinite recursive mess. Backtracing the process in GDB is useless because the call stack frame is at least 1000 frames deep, and the repeated function calls are series of four common…
dandrews
  • 223
11
votes
1 answer

How can I get the number of threads running in a process from /proc/[pid]/stat in Linux?

I have the pid of the process. I would like to know the current number of thread running in the process. I know I can read /proc/pid/stat for this information, but I'm not sure how to specifically get the number of threads from stat. Can anyone…
Irlanco
  • 213
11
votes
5 answers

Does linux have any measures to protect against fork bombs?

#include int main(int argc, char* argv[]) { while(1) { fork(); } } I run this program on my linux, nothing outputs on the terminal, the OS seems go dead. Does linux have any protection measure to such program which can run out…
venus.w
10
votes
3 answers

Why doesn't '>' redirect error messages from gcc?

I stored the following program in new.c int main() { a; return 0; } It returns an error message. I want to send this message to a file. So I used the following command gcc new.c > temp.txt But still I was getting the output on the…
Alex
  • 201
  • 1
  • 2
  • 5
10
votes
2 answers

How do I install package libc6-dev-i386 on fedora?

When I make yum install libc6-dev-i386 it says no package found, I searched on google and I only found that package for ubuntu or debian.
gn66
  • 203
9
votes
2 answers

How to copy a DVD with a patched UDF filesystem / bad sectors?

I tried dd, dd_rescue and ddrescue, all failed. Since AnyDVD makes the disc copyable in a second on a Win7 host, it should not be too difficult. It says that the UDF filesystem is patched, curiously, it also says that there are no bad sectors. The…
Ali
  • 325
1
2 3
20 21