How to create a file of fixed size

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Man4ish
    New Member
    • Mar 2008
    • 151

    How to create a file of fixed size

    I am trying to create a file of fixed size. I am using setw() e.g.
    43 68 + 169161408
    115 287 + 169161408
    I am using setw() after first column

    cout<<col1<<set w(20)<<col2<<se tw(20)<<col3<<s etw(20)<<col4<< endl;

    But still all records are not of fixed length I have calculated the length but in some cases it is coming different.


    Regards
    Manish
  • weaknessforcats
    Recognized Expert Expert
    • Mar 2007
    • 9214

    #2
    You will have to create your file and write the necessary characters to it.

    Say you want 1000 100 character records. You therefore write 1000 blocks of 100 characters.

    Comment

    Working...