Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9024019
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T05:54:15+00:00 2026-06-16T05:54:15+00:00

We all know how to print a string one tab further with \t printf

  • 0

We all know how to print a string one tab further with \t

printf ("Hello\tthere!\n");

which outputs:

Hello    there!

What about printing one tab backwards? I know we can just use \r to start back from the beginning of the line, but there are situation when indentation is more complex than that, I am looking for something like \bt (if it existed) such that I could write:

printf ("Hello\tthere! \n\tHow\n\btare you?\n");

to get in output:

Hello    there!
             How
         are you?

Edit

I am surprised by the amount and speed of replies here, and sometimes even by the uselessness of some comments, but only a few. What I am trying to achieve is of course more complex than this, it’s properly formatting an XML file to be easily readable. I wanted to be sure there wasn’t an easier way, the response confirmed there wasn’t thanks.

Edit 2

Sorry guys, you are right to vote down this question, first because I didn’t specify I was writing to a text file, secondly because I was assuming tabs could be “remembered” by the file handler. Sorry for wasting your time.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T05:54:16+00:00Added an answer on June 16, 2026 at 5:54 am

    With printf you control how much tabbing is taking place explicitly. To back tab you would just use fewer tabs. From the example you provided it looks like you are expecting the tab level to be remembering, and have How indented farther than it really will be when printed. It would appear at the same tab stop as there! and are you?

    Assuming with:

    printf ("Hello\tthere! \n\tHow\n\btare you?\n");
    

    You are expecting to see:

    Hello   there! 
        How
    are you?
    

    Then just don’t add the tab before are you? and you will get what you want. To get fewer tabs, just add fewer \t symbols to your printf. printf doesn’t have any memory of what tabbing has occurred before.

    printf ("Hello\tthere! \n\tHow\nare you?\n");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The point of M-V-VM as we all know is about speraration of concerns. In
We all know about Boost . What other free C++ libraries are worth using?
Possible Duplicates: Getting strange output when printing result of a string comparison Hi all,
I have so many strings and i want to print them all one by
I make no claims to know anything at all about writing Python scripts or
We all know that openId has become such a popular method for user authentication,
We all know of sleep method available in java threads.. I understand that the
We all know that CSS sprite images are great to reduce the amount of
We all know the effects that lots of thrown exceptions can have over the
We all know that a hash table has O(1) time for both inserts and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.