I am talking about console C file .
Can I insert images or colors in my C file? How?
I am talking about console C file .
Can I insert images or colors in my C file? How?
It depends. What computer platform and compiler?
its falcon C++ IDE
and os Win7
"...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson
For what it's worth, there are some FAQ entries that might help you along.
FAQ > Display a picture file in DOS - Cprogramming.com
FAQ > Color my text - Cprogramming.com
"...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson
For simple color text, I notice there is a simple "colorprintf" project on Github that you can use as a quick way to output color text.
https://github.com/VittGam/colorprintf
That should get you started with color on the console at least. The issue of color text on a text console can be complicated by cross-platform issues.
For images, can you describe more precisely what you want to do? For example, if you literally mean to display a graphical image on a (text-based) console, there are some libraries to help you do this (libcaca and aalib are two that come to mind). The image data would be converted to "ASCII Art" characters which resemble the original image on the text console.
On the other hand, if you want to display a graphical image in the normal fashion, then you simply can't use a console. You probably want to write a GUI application. Probably the most straightforward way to do this is to use a library/GUI framework designed for this. Examples are Qt, GTK, Fltk. All of these three offer tutorials for learning the basics, including displaying images.
Last edited by c99tutorial; 12-26-2012 at 04:46 PM.
Warning: Opinions subject to change without notice
The C Library Reference Guide
Understand the fundamentals
Then have some more fun
Can you suggest a good small (about 6MB) C compiler(not IDE)??
i tend to use pelles for c , and VC++ for my c++, but have also used GCC for C on some older systems, as it is semi small footprint.....
GCC GCC, the GNU Compiler Collection - GNU Project - Free Software Foundation (FSF)
An image is a set of pixel values internally, usually red, green and blue from 0-255. There's no way of representing this in C except by an array of unsigned chars. So one solution is to write .little utility to read in an image, and print it out as an array. However this is a a bit clumsy, so a lot of compilers offer an option to embed images. You then need a platform-specific library function to access the image data.
A portable, ANSI C only, console program cannot display images. All it can do is write characters to standard output, or create files. However these files can be image files. The BMP, GIF and JPEG file formats are all explained in my book, Basic Algorithms.
I'm the author of MiniBasic: How to write a script interpreter and Basic Algorithms
Visit my website for lots of associated C programming resources.
https://github.com/MalcolmMcLean
These are sreenshots of color screens I've made using the console only, either using conio.h or windows.h functions:
Colors are limited, for both foreground and background. Windows.h offers some limited texturing of the color, which gives it a more "wood grain" type of look.
Conio.h works with Windows. There are newer header files that have these same functions (and more), which work with Linux and/or Windows, as well. PDcurses and Ncurses comes to mind. I haven't used them, however.
Last edited by Adak; 12-27-2012 at 04:37 PM.