problem on writing to a file

If you have a script you think might be useful to others post it
here. Hopefully we will be able to get the most useful of these incorporated in the manuals.

Moderators: silvia, selimgunay, Moderators

Post Reply
hamedpar
Posts: 3
Joined: Fri Jun 26, 2009 12:36 pm
Location: amir kabir university

problem on writing to a file

Post by hamedpar » Fri Jun 26, 2009 12:47 pm

I would like to write the $folder amount every time after the file OUTPUT.TXT opend.how can i write this code? here is the code that i used it for writing but evey time instead of writing $folder in new line it delet the prevous amout and writes only the new one.


[code]set fileId [open D:/OUTPUT.txt w 0600]
puts $fileId " $folder"
close $fileId[/code]

silvia
Posts: 3912
Joined: Tue Jan 11, 2005 7:44 am
Location: Degenkolb Engineers
Contact:

Post by silvia » Mon Jun 29, 2009 8:49 am

open it only once.
otherwise, use the a (append) tag.
Silvia Mazzoni, PhD
Structural Consultant
Degenkolb Engineers
235 Montgomery Street, Suite 500
San Francisco, CA. 94104

anovin
Posts: 2
Joined: Sat Apr 17, 2010 2:23 am
Location: Novintabligh
Contact:

Post by anovin » Sat Apr 17, 2010 2:32 am

You should use the append (a) tag instead of write (w).
Novintabligh Director
www.novintabligh.com

mexkuz
Posts: 1
Joined: Fri Apr 23, 2010 2:36 pm
Contact:

Post by mexkuz » Fri Apr 23, 2010 2:41 pm

Thank you for your reply, I had the same problem. :D
Last edited by mexkuz on Mon Oct 06, 2014 12:16 am, edited 1 time in total.

alekm
Posts: 1
Joined: Tue Jul 20, 2010 2:34 pm
Contact:

Post by alekm » Tue Jul 20, 2010 2:35 pm

worked like a charm! thanks :)

walter99
Posts: 1
Joined: Tue Aug 31, 2010 7:10 am
Contact:

Post by walter99 » Tue Aug 31, 2010 7:15 am

the append-tag should help

kengawk
Posts: 104
Joined: Wed Oct 31, 2007 11:55 pm
Location: Beijing JIaotong University
Contact:

Re: problem on writing to a file

Post by kengawk » Fri Jul 08, 2011 5:52 am

yeah, if create a file, use the CREAT tag;
how can I create and then append?
Kai Zhang
------------------------------
PH.D. candidate
School of Civil Engineering&Architecture
Beijing Jiaotong University

fmk
Site Admin
Posts: 5866
Joined: Fri Jun 11, 2004 2:33 pm
Location: UC Berkeley
Contact:

Re: problem on writing to a file

Post by fmk » Mon Sep 12, 2011 1:25 pm

open the file with a w to create it .. if you need to cloe the file in the script, open it subsequently with an a to append to it.
if you don't close it you don''t have to open it again.

dantefrizzoli
Posts: 4
Joined: Mon May 27, 2013 4:07 pm
Location: Las Vegas, NV

Re: problem on writing to a file

Post by dantefrizzoli » Mon May 27, 2013 4:20 pm

Ahh I had this same problem. Seems like common sense after I fixed it =/
I'm a current master student at UMD researching geology and simulation software architecture. I also enjoy cycling, golf and writing for http://www.ultius.com

theidealpaper
Posts: 1
Joined: Wed May 20, 2020 9:36 am
Contact:

Re: problem on writing to a file

Post by theidealpaper » Wed May 20, 2020 9:38 am

Kampala International University (KIU) founded in 2001 is a private chartered University in the Republic of Uganda. It is a member of the Association of Commonwealth Universities, the Association of Africa Universities as well as the Inter University-Council of East Africa. KIU offers a variety of programs in Health Sciences, Science and Technology, Engineering, Business and Management, Law, Humanities and Education.

https://kiu.ac.ug/

stellamartin
Posts: 5
Joined: Thu Apr 30, 2020 2:01 am
Contact:

Re: problem on writing to a file

Post by stellamartin » Fri Jun 12, 2020 2:06 am

Very Awesome blog I had every seen in my life. I just try to make our blog also more popular and interesting then I offer all the informative content in this. if you are interested in gaining knowledge then visit Buzz from Tech World and explore the entire world by just sitting in the front of your device.


angelajoneshere
Posts: 1
Joined: Thu Jul 23, 2020 10:41 pm
Contact:

Re: problem on writing to a file

Post by angelajoneshere » Thu Jul 23, 2020 11:12 pm

Thanks for sharing
Latest Update: Get $20 off $100 Target Promo Code

thavaselvan
Posts: 1
Joined: Fri Aug 07, 2020 7:01 am
Contact:

Re: problem on writing to a file

Post by thavaselvan » Fri Aug 07, 2020 7:09 am

Informative thanks for sharing

Post Reply