This page has been designed specifically for the printed screen. It may look different than the page you were viewing on the web.
Please recycle it when you're done reading.
The URI for this page is { http://cc.byexamples.com }
Archives -
Posts tagged as 'c'
-
Calling Lua function from c++ is very simple. Value passing between c++ and Lua goes through stack, Lua C API provides a convenience ways for ... Continue
-
When I was assigned a project to create a text console based simulator, I am looking into how to keep a history list of entered ... Continue
-
Sometimes you need to construct a structure which the variables in the structure is not specified in bytes, instead bits. It may occur when you ... Continue
-
A simple challenge for c/c++ fans, use only 2 variable and 2 for loop to print a pascal triangle looks as bellow
... Continue
-
This is an interesting quest given by my friend who working in Intel, during our conversation online.
How to swap two variables ?
Let say A=123 and ... Continue
-
Don't know whether you aware of the example code at Tap the interrupt signal, I am using sleep(1) within endless loop at the first sample ... Continue
-
When you hit control+c, you are actually send a SIGINT ( Interrupt signal ) to your program. By default, your program will be terminated after ... Continue
-
The title sounds a bit awkward, let my briefly explain what is it all about.
In my program, I want to wait for user input, ... Continue
-
Do you feel like writing a nice CLI Application? Where you can manipulate your text in any position and any combination of colors. There are ... Continue
-
If you wanna create a time stamp that display date and time, you can simply uses asctime() and localtime(), time() and a time_t variable to ... Continue
-
It is very important to clean your container before you put your stuff in. It might dirty your stuff if you do not do so. ... Continue
-
We can actually do this to print text on screen,
fprintf(stdout,"Hello %s\n","World");
But why?
Try to imagine that you are doing a debug log file function, which ... Continue
-
To write formatted string to files, the easiest way is uses fprintf. It works exactly the same way like printf.
File * fp=fopen("filename","w");
fprintf(fp,"%s.%s = %d\n", ... Continue
-
Notice that almost all linux programs have command-line options, you can pass in the arguments to your programs. Some common arguments such as:
dummy -v
dummy --help
So ... Continue
-
Move your cursors to any position and print, it does the way just like how to change the color and attributes of the font illustrated ... Continue
-
Printing color strings uses only printf, without any alternative libraries such as ncurses? Yes, we can do that in any unix based operating system that ... Continue
-
The simplest debug technique is to print out a line contains the required variables value. By printing out a line at a suspect bugs point, ... Continue
-
The printf function can have variable length of arguments pass into the function. Sometimes we might want to create a customized printf like function. Observed ... Continue
-
In order to store a particular value to variable from a string, we can use sscanf.
Definition:
int sscanf(const char *str, const char *format, ...);
To store a ... Continue
-
Sometimes we might need to declare global variable. Let say I have 5 files (cat.c, dog.c, tiger.c, rabbit.c and animal.c). I declare a global integer ... Continue