Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TCL - file problem 1

Status
Not open for further replies.

lakshmivaragan

Programmer
Sep 30, 2003
25
IN
Hi,
When TCL variables are used for writing a file, the record length varies. This seems to be problem when:
1. Random access to records. Since record size varies we can't use tell or seek to point to any of the records and get it.
2. Rewrite a file. If I try to rewrite file with value larger than the previously written value it affects the next record.

Is there any way in TCL so that files can be written with uniform record length ?

Thanx
Lax

 
Actually, if you want to ensure that each record is exactly 200 characters, you'll also want to truncate values that exceed 200 characters. The conversion specifier [tt]%-200s[/tt] will space-pad out to at least 200 characters, but not truncate longer values. The conversion specifier [tt]%-200.200s[/tt] will truncate longer strings to exactly 200 characters.

- Ken Jones, President, ken@avia-training.com
Avia Training and Consulting, 866-TCL-HELP (866-825-4357) US Toll free
415-643-8692 Voice
415-643-8697 Fax
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top