Go to Post Maybe Dave's just bananas for FVC? - Billfred [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
Prev Previous Post   Next Post Next
  #7   Spotlight this post!  
Unread 11-02-2013, 06:44
kenfox kenfox is offline
Registered User
FRC #3322 (Eagle Imperium)
Team Role: Mentor
 
Join Date: Jan 2013
Rookie Year: 2013
Location: Ann Arbor, MI
Posts: 52
kenfox is a glorious beacon of lightkenfox is a glorious beacon of lightkenfox is a glorious beacon of lightkenfox is a glorious beacon of lightkenfox is a glorious beacon of light
Re: Printing to a text file

Quote:
Originally Posted by mrklempae View Post
So we can write to a text file
Yes.

Don't ignore smart dashboard though. I really think it will be better for you to try that first. Smart dashboard is useful for debugging, but can also be used during a competition match to show information on your driver station.

Quote:
we can't read it unless we FTP the file
Yes.

Quote:
we need to use the Preferences class to create and access it
No. You can use standard file I/O routines to open and write to files. We use C stdio which looks like this:

Code:
#include <stdio.h>
...
FILE *output = fopen("/3322-output.txt", "w");
if (output) {
  fprintf(output, "hello world\n");
  fclose(output);
}
The file written above can be viewed with a web browser by visiting "ftp://10.te.am.2/3322-output.txt".

C++ stream I/O routines should also work, but I haven't tried. Can you post some working code if you get C++ streams working?

Quote:
can we still do complex tasks with the data such as reading comma separated values into an array?
Yes.

The cRIO is an independent computer with its own files. The driver station is another independent computer. The cRIO and driver station use a limited network connection to communicate. If you want to share files between them you must copy them by FTP.

The only problem we've found using the cRIO file system with C is it will occasionally pause for up to 100ms to write data to permanent storage (flash storage). The C stdio routines I showed above buffer writes in memory. When the buffer fills up, it has to be written to permanent storage and that takes a long time.
Reply With Quote
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 03:34.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi