Go to Post Heidi's best picture ever - and she didn't even have to Photoshop this one! - dlavery [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 06-04-2010, 14:09
amk's Avatar
amk amk is offline
Registered User
AKA: Ann Kowalczyk
FRC #0503 (Frog Force)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Novi, MI
Posts: 30
amk is an unknown quantity at this point
file i/o in java

Does anyone have example code for how to open and write to a text file on the cRIO? We would like to write out information while the robot for debugging purposes, then ftp the file to a laptop for viewing. Any help is appreciated.
Reply With Quote
  #2   Spotlight this post!  
Unread 06-04-2010, 17:49
Robototes2412's Avatar
Robototes2412 Robototes2412 is offline
1 * 4 != 14
FRC #2412 (Robototes)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2007
Location: Bellevue
Posts: 312
Robototes2412 is on a distinguished road
Re: file i/o in java

if i remember right, they removed that feature from java, i suggest writing a class in c++ then use JNA to call it
Reply With Quote
  #3   Spotlight this post!  
Unread 06-04-2010, 20:37
rrossbach rrossbach is offline
Registered User
AKA: Ron R
FRC #2607 (RoboVikings)
Team Role: Mentor
 
Join Date: Nov 2008
Rookie Year: 2008
Location: Warrington PA
Posts: 90
rrossbach is a splendid one to beholdrrossbach is a splendid one to beholdrrossbach is a splendid one to beholdrrossbach is a splendid one to beholdrrossbach is a splendid one to beholdrrossbach is a splendid one to beholdrrossbach is a splendid one to behold
Re: file i/o in java

Quote:
Originally Posted by amk View Post
Does anyone have example code for how to open and write to a text file on the cRIO? We would like to write out information while the robot for debugging purposes, then ftp the file to a laptop for viewing. Any help is appreciated.
Take a look at my post here for an example.

- Ron
Team #2607 controls mentor
Reply With Quote
  #4   Spotlight this post!  
Unread 07-04-2010, 23:20
derekwhite's Avatar
derekwhite derekwhite is offline
Java Virtual Machine Hacker
no team (FIRST@Oracle)
Team Role: Programmer
 
Join Date: May 2009
Rookie Year: 2009
Location: Burlington, MA
Posts: 127
derekwhite is on a distinguished road
Re: file i/o in java

I'll second Ron's approach.

As an FYI, once you have an OutputStream to the file, you can wrap it with a PrintStream and use the typical print methods on the file.


Quote:
PrintStream out;
DataOutputStream theFile;
FileConnection fc;

try {
fc = (FileConnection)Connector.open("file:///output.txt", Connector.WRITE);
fc.create();
theFile = fc.openDataOutputStream();
out = new PrintStream(theFile);
} catch (Exception e) {
...
}

Last edited by derekwhite : 07-04-2010 at 23:23. Reason: typo
Reply With Quote
  #5   Spotlight this post!  
Unread 08-04-2010, 02:49
spartango spartango is offline
Registered User
FRC #0192 (GRT)
Team Role: Alumni
 
Join Date: Nov 2009
Rookie Year: 2008
Location: Palo Alto, CA
Posts: 43
spartango is an unknown quantity at this point
Re: file i/o in java

See
http://code.google.com/p/grtframewor...GRTFileIO.java

You can use that file verbatim or copy it and use its innards in your code.
Reply With Quote
  #6   Spotlight this post!  
Unread 08-04-2010, 13:20
Robototes2412's Avatar
Robototes2412 Robototes2412 is offline
1 * 4 != 14
FRC #2412 (Robototes)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2007
Location: Bellevue
Posts: 312
Robototes2412 is on a distinguished road
Re: file i/o in java

THanks, is there anyway to append to a file?
Reply With Quote
Reply


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
**FIRST EMAIL**/Java and Orbit Balls *****JAVA DISCUSSION*** Pjohn1959 Programming 37 31-08-2009 15:55
How to use the data obtain in one C file to another C file? tommy_chai Programming 8 11-01-2008 02:17
"Error.MCP" file after HEX file trans iwdu15 Programming 1 24-01-2007 20:05
Help! making an inventor file into an autodesk file kjhobin Inventor 5 19-03-2006 23:04
How do we convert a modified user routines file into a valid .HEX file HuskieRobotics Programming 13 28-02-2004 12:12


All times are GMT -5. The time now is 22:42.

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