Tagged Questions

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.

learn more… | top users | synonyms

0
votes
3answers
208 views

What to change to place text in the centre of the screen [closed]

The following program will clear the screen #include <stdio.h> int main() { fputs("\033[2J", stdout); return 0; } So, what should I modify/add in the above code to put a text string ...
5
votes
4answers
983 views

Does optimizing for size reduce runtime memory usage as well as binary size?

Does optimizing for size with gcc -Os only reduce the binary size of a program, or does it reduce its runtime memory usage as well? I know what exactly the results are depend on the specific code, but ...
6
votes
1answer
317 views

Why would one want to compile multiple .cpp files to the same executable?

Why would you do g++ -Wall -I/usr/local/include/thrift *.cpp -lthrift -o something instead of: g++ -Wall -I/usr/local/include/thrift -c Something.cpp -o something.o g++ -Wall ...
0
votes
1answer
3k views

how to Update gcc of OpenSuse 11.2?

I have OpenSuse 11.2 with gcc version 4.4.1. I would like to update my gcc version to 4.5.1. I have downloaded gcc-4.5-19.1.i586.rpm. When I rpm install it, it's asking for ...
0
votes
3answers
5k views

/usr/ucb/cc: language optional software package not installed

I tried to compile some C code to get object file from a shell prompt: $cc a.c But this gives me the following error: /usr/ucb/cc: language optional software package not installed How can I ...
9
votes
3answers
6k views

Man pages for standard C and C++ libraries on Fedora 14

How do I install them? At present, man fopen gives me No manual entry for fopen. I have the compilers installed and have verified that things do build without problems. Update: This is what I got ...
6
votes
4answers
11k views

make a log file

Is there any way to make a log file for maintaining some data in /var/log/ with the help of some library function or system call in c language in linux. And I also want to know the standards that we ...
3
votes
2answers
348 views

Is there a glibc API that can find the default handing application for a MIME type on linux?

I want to find the default handling application in my C program. Is there a C API with same functionality as xdg-mime query default mime-type on Linux?
6
votes
1answer
250 views

Executing a shared library

Some shared libraries provide an output when called from the command line as if they were executables. For example: $ /lib/libc.so.6 GNU C Library stable release version 2.13, by Roland McGrath et ...
4
votes
2answers
2k views

Implementing a Unix shell in C: Logging

I am currently working on implementing my own UNIX shell in C. The basis of the shell is working, you could find the source code here. Right now my next task is to implement a logging feature for the ...
8
votes
4answers
2k views

Why should a child of a vfork or fork call _exit() instead of exit()?

From the man page of vfork(): vfork() differs from fork() in that the parent is suspended until the child makes a call to execve(2) or _exit(2). The child shares all memory with its ...
15
votes
4answers
4k views

After fork(), where does the child begin its execution?

I'm trying to learn UNIX programming and came across a question regarding fork(). I understand that fork() creates an identical process of the currently running process, but where does it start? For ...
1
vote
1answer
268 views

Recording and charting boot process information in Linux

I need to write a command line tool that records the boot process information in Linux, and then renders it in a chart format (a textual chart would do). How do I programmatically obtain the this boot ...
6
votes
5answers
3k views

Develop / Debug C / C++ on Ubuntu?

What's the best IDE for developing C / C++ on Ubuntu? I tried installing Eclipse but it seems like I need the eclipse-cdt package also. The problem is there is no such package, at least for Lucid. ...
3
votes
1answer
4k views

Error when using stat, errno=2

The case is as this, I create many files, and after the file generation, I use stat to get the all files info under the directory. The purpose is to purge all the files which are old than the ...
6
votes
1answer
3k views

How can i know which unistd.h file is loaded?

I have several unistd.h files in my Ubuntu Linux. I've one on: /usr/include/asm/unistd.h This file has this directives: # ifdef __i386__ # include "unistd_32.h" # else # include "unistd_64.h" # ...
8
votes
10answers
1k views

Development environment for C

Looking for ideas on setting up a convenient and productive development environment for C development. I found C editing with Vim very helpful but I would like to get a wider sampling of suggestions.