|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
Team 3132 - Sample code for writing to a file on the cRIO
There's been a couple of threads about trying to write to a file on the cRIO (including one of my own), and even a request to see how we get it to work.
The code isn't heavily commented, but hopefully you can see what it's doing, as there's not much there. So, here is code for writing to a log file on the cRIO, courtesy of Team 3132 - The Thunder Down under. If you add the attached files to your code, you can then call it as follows: * Get the logger instance through a call such as this.. Logger* logger = Logger::GetInstance(); * Add logging statements to your code as follows: if (logger->IsLogging()) { logger->Log(Logger::kINFO, "Bruce has initialised"); } * The call to IsLogging() is optional, but is a hangover from my day job programming Java, where string creation is (used to be) expensive. Either way, if you have a large amount of code in your debugging, in order to calculate valued to log, but only at certain times, then best to surround it in a similar check so it's not calculated, but then never used. When your code has finished, you can FTP to your cRIO (10.xx.yy.2) as anonymous (empty username and password) and download the file to your computer to read and analyse. Standard disclaimers: I wrote it from scratch so I can distribute it, it's provided as is, I can't support you all, try it out if you like, don't blame me if it doesn't work for you, results may vary, handwash only, shrinkage may occur. Hope this helps some of you. |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Data File Writing ... cRIO vs. Driver Station | Ziaholic | NI LabVIEW | 3 | 01-31-2010 03:20 PM |
| Where do I download the 2010 sample vision code? | CollinRyans | Programming | 3 | 01-28-2010 09:42 PM |
| "Battery: No Code" after uploading .out file to cRIO | knine143 | FRC Control System | 1 | 12-20-2008 10:14 PM |
| Getting the .hex code file only for a given function | visent | Programming | 0 | 02-14-2008 07:06 AM |
| Reading binary data from a file and writing it in VB | complete | Programming | 1 | 01-02-2006 09:21 PM |