Go to Post The championship event is a meta-game of inches. People will complain about unbalanced/unequal divisions, whether you think it's silly or not. - PayneTrain [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 04-06-2010, 02:09 PM
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 04-06-2010, 05:49 PM
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 04-06-2010, 08:37 PM
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 04-07-2010, 11:20 PM
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 : 04-07-2010 at 11:23 PM. Reason: typo
Reply With Quote
  #5   Spotlight this post!  
Unread 04-08-2010, 02:49 AM
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 04-08-2010, 01:20 PM
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 08-31-2009 03:55 PM
How to use the data obtain in one C file to another C file? tommy_chai Programming 8 01-11-2008 02:17 AM
"Error.MCP" file after HEX file trans iwdu15 Programming 1 01-24-2007 08:05 PM
Help! making an inventor file into an autodesk file kjhobin Inventor 5 03-19-2006 11:04 PM
How do we convert a modified user routines file into a valid .HEX file HuskieRobotics Programming 13 02-28-2004 12:12 PM


All times are GMT -5. The time now is 07:36 AM.

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