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 7702927
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T23:20:27+00:00 2026-05-31T23:20:27+00:00

I have this Structure the elements of which that I need to write in

  • 0

I have this Structure the elements of which that I need to write in a text file

struct Stage3ADisplay
{
    int nSlot;
    char *Item;
    char *Type;
    int nIndex;
    unsigned char attributesMD[17]; //the last character is \0
    unsigned char contentsMD[17]; //only for regular files - //the last character is \0
};  

buffer = malloc(sizeof(Stage3ADisplayVar[nIterator]->nSlot) + sizeof(Stage3ADisplayVar[nIterator]->Item) + sizeof(Stage3ADisplayVar[nIterator]->Type) + sizeof(Stage3ADisplayVar[nIterator]->nIndex) + sizeof(Stage3ADisplayVar[nIterator]->attributesMD) + sizeof(Stage3ADisplayVar[nIterator]->contentsMD) + 1);

sprintf (buffer,"%d %s %s %d %x %x",Stage3ADisplayVar[nIterator]->nSlot, Stage3ADisplayVar[nIterator]->Item,Stage3ADisplayVar[nIterator]->Type,Stage3ADisplayVar[nIterator]->nIndex,Stage3ADisplayVar[nIterator]->attributesMD,Stage3ADisplayVar[nIterator]->contentsMD);

How do I make sure the rows in the file are properly aligned.
Thank you.

  • 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-05-31T23:20:28+00:00Added an answer on May 31, 2026 at 11:20 pm

    If your question relates to sprintf ,

    Change

     sprintf (buffer,"%d %s %s %d %x %x"
    

    to

     sprintf (buffer,"%22.22d %22.22s %22.22s %22.22d %22.22x %22.22x"
    

    to see how %nn.nn works.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this menu structure that is used to navigate through content slider panels.
I have this file structure: folderIWantStuffIn/ - old_stuff Now I want to add some
Given that I have this resultset structure (superfluous fields have been stripped) Id |
In a Python system for which I develop, we usually have this module structure.
I have several .list elements which all need a red color. Of these .list
So, I have an app/assets/stylesheets/ directory structure that looks something like this: |-dialogs |-mixins
I have an html structure that looks like this: <h5>Title</h5> <p> Content </p> <ul>
Assuming Visual C/C++ 6, I have a complex data structure of 22399 elements that
I have a structure , which present my element of data struct myElement {
I have this structure on form, <input type=test value= id=username /> <span class=input-value>John Smith</span>

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.