I am talking about console C file .
Can I insert images or colors in my C file? How?
Printable View
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
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
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.
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.
Attachment 12381
Attachment 12382
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.
[quote]Can you suggest a good small (about 6MB) C compiler(not IDE)?? [quote]
I dont think any modern ones of that size would exist - My Mingw folder (which includes the debugger gcc) is 113mb - i have added a few libraries and stuff but i think
even the include folder alone would be about 4mb
[QUOTE=rogster001;1142239][quote]Can you suggest a good small (about 6MB) C compiler(not IDE)??Try tcc, or the Tiny C compiler.Quote:
I dont think any modern ones of that size would exist - My Mingw folder (which includes the debugger gcc) is 113mb - i have added a few libraries and stuff but i think
even the include folder alone would be about 4mb
TCC : Tiny C Compiler
It is possible through Graphics.h. You can gain much knowledge about adding images and colors through this header file, in Help of C turbo 3.0.
That is a very bad recommendation - this is a seriously outdated toolchain - do not take this advice unless you want to program like it was the 1990s and your kit is the same also.Quote:
It is possible through Graphics.h. You can gain much knowledge about adding images and colors through this header file, in Help of C turbo 3.0.