- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Suppose you have an 5-digit integer variable and read into it the following: 03928
Immediately after the read, the variable appears to contain '3928'.
Later, this same variable is written out via format i5, and it appears as '_3928' (the leading zero has disappeared).
If the original value is replaced by '13028', it reads and writes exactly as expected, i.e., all 5 digits are preserved.
If I handled this as a character, I could manage this issue. But handling it as an integer, why does the compiler appear to swallow the leading zero in the 5-digit integer? Is there an easy way to preserve it?
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Instead of i5 format use I5.5 which always outputs 5 digits padded with leading zero's
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks app4619. I was thinking about ix.x - I've used this before for what I thought were other purposes. It didn't dawn on me that it was applicable here.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page