i just wanna ask if can i format centered the outputs of turbo c? just like when you do in microsoft word. thank you!

I'm again assuming that your output is to the command prompt. And the answer is yes, but not as easily as setting a center attribute. When it comes to "formatting" in the command prompt you need to fill the line with leading spaces to put it where you want. For example:

#include <stdio.h>
#include <string.h>
#include <Windows.h>

void PrintCenteredLine(const char *s)
{
    HANDLE console = GetStdHandle(STD_OUTPUT_HANDLE);
    CONSOLE_SCREEN_BUFFER_INFO screen_buf;

    if (GetConsoleScreenBufferInfo(console, &screen_buf)) {
        int width = screen_buf.dwSize.X;
        int fill = (width / 2) - (strlen(s) / 2);
        int i;

        for (i = 0; i < fill; ++i)
            putchar(' ');

        puts(s);
    }
}

int main()
{
    PrintCenteredLine("Giggidy giggidy goo");
    return 0;
}

how to use center_text? can you give a sample code? thanks!

how to use center_text? can you give a sample code? thanks!

I don't know what that is. Is it some function that Turbo Shit supports?

Yes i found it in the Help but the explanation sucks.

If you don't post what you found in the help files, I have no choice but to let someone who knows what you're talking about devine what exactly you're having trouble with and explain it to you.

Then don't use it. Write your own version and you'll know how it works.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.