View Single Post
  #10   Spotlight this post!  
Unread 27-01-2014, 11:54
Jon Stratis's Avatar
Jon Stratis Jon Stratis is offline
Electrical/Programming Mentor
FRC #2177 (The Robettes)
Team Role: Mentor
 
Join Date: Feb 2007
Rookie Year: 2006
Location: Minnesota
Posts: 3,784
Jon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond repute
Re: File IO without overwriting file

What about creating a new log file each time? That's how things are handled with the server production systems I work with - each log file has a timestamp as part of the file name to help prevent overwrites.

I'm not sure how the clock works on the cRIO or what level of access we have towards getting a standardized timestamp, but there are other options as well. For example, you can have each log file generated with an incrementing numerical value (1.log, 2.log, etc). Keep the current value in a config file (log.config). When the program starts up, it reads the config file, increments by 1, writes the new value out to the config file (overwriting the old value) and creates the log file using that value.

This has the added benefit of giving you a separate log file for each run, which will help you keep everything organized.
__________________
2007 - Present: Mentor, 2177 The Robettes
LRI: North Star 2012-2016; Lake Superior 2013-2014; MN State Tournament 2013-2014, 2016; Galileo 2016; Iowa 2017
2015: North Star Regional Volunteer of the Year
2016: Lake Superior WFFA
Reply With Quote