TCL/TK Data structures- URGENT

Posted on 2005-04-29
Last Modified: 2012-05-05

Does anybody know how to save data entries in a list data structure in tcl/tk? or some other way? i have a small form with some text widgets and i want to save the contents in a file so that i can load the file in future..

All help appreciated.
Question by:Jaysri

    Author Comment

    Actually i mean - how to dump the contents of text widget to a file, for later use? Please respond if you know..
    LVL 7

    Accepted Solution

    You can use the "open" and "puts" commands from tcl.
    For example if you have a widget like:
    entry .base -textvariable base

    Then you can save the data to a file named "abc" by:
    set fileid [open abc w]
    puts $fileid $base
    close $fileid

    Later on you can read this back from file "abc" into a variable named "newbase" by
    set fileid [open abc r]
    gets $fielid newbase

    LVL 7

    Expert Comment

    Fine by me!
    Jaysri, I hope it helped.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    PDF library for Delphi 2 82
    How does a lexer and parser works 2 71
    tripleUp challenge 7 54
    seriesUp challenge 7 83
    Having just graduated from college and entered the workforce, I don’t find myself always using the tools and programs I grew accustomed to over the past four years. However, there is one program I continually find myself reverting back to…R.   So …
    The purpose of this article is to demonstrate how we can use conditional statements using Python.
    This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
    This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now