Console-Text-Format-lib is a C library that can handle different text formats and alignments. It also has the ability to create text-based graphics. Developers have to go through a difficult path to deal with the strings of the C language. It will be more difficult in console programs. Therefore, this library helps to reduce the size of the code for printing.
When you want to print text in the center of the console window, you will do the following; But do you believe you can find the right center using the tab spaces?
printf("\t\t\tLet's hope this is a ceter-aligned text.");
- Text alignment of the output (left, center, right)
- Change the buffer width of the formatted text
- Draw borders (left & right) of the formatted text.
It will help to create text arts, tables, shapes, etc.
- Draw horizontal lines with user-defined settings (line format, size, ends)
- Ability to combine text format functions with line drawing functions.
- Add the static library and the header to your c project It is better if you make a folder (ex:include) for headers in your workspace folder.
- Add the include path to project in your IDE or text editor.
VsCode: c_cpp_properties.json
"includePath": [ "${default}", "${workspaceFolder}/include" ],
- include the header (contf.h) to your code.
- Compile the code with including the header and the library
gcc -g {C file} -I {include folder} -L {library folder} -lcontf -o {output file}
VsCode: tasks.json
"args": [ "-g", "${file}", "-I", "${workspaceFolder}\\include", "-L", "${workspaceFolder}", "-lcontf", "-o", "${fileDirname}\\${fileBasenameNoExtension}.exe" ],
- Make sure to don't run the program in intergrated terminals.
libcontf won't initialize in intergrated terminals.VsCode: launch.json
"externalConsole": true,
Copyright (c) 2021 Naveen Dharmathunga