View unanswered posts | View active topics It is currently Mon Sep 21, 2020 11:27 am

Reply to topic  [ 2 posts ] 
File I/O on NXT. Creation of files to read... 
Author Message

Joined: Tue Mar 06, 2007 2:06 pm
Posts: 3
Location: Philipsburg, PA
Post File I/O on NXT. Creation of files to read...
I need to read an external ascii file that defines the parameters for a competition. The plan is to create 3 or 4 'master' files that can be read by the NXT. I would like to first process the file on a windows pc and get the 'master' files on the NXT so the program can read the details and process accordingly. I could do all of the processing on the NXT but would rather not.

How do I create a simple file with a format like 1, "NAME", 32, True where this file may have 10 or 20 entries?

Reading the files on the NXT is my issue. ReadByte is character by character. ReadShort and Long provide odd results. Maybe the file should not be comma delimited. Maybe no quotes. I've tried many different approaches but have yet to find a solution.

Sun Feb 10, 2008 7:16 pm

Joined: Fri Feb 09, 2007 9:21 am
Posts: 616
You need to write a "parser" to read the ASCII text from the file and convert it to numbers and strings. And scan for commas or blanks as delimiters between fields on a line. And scan for char '0x0d' (carriage return?) as the delimiter between lines.

The example for GPS -- it's in the Bluetooth sample folder because the GPS receiver connects via GPS -- has some programs for parsing a GPS ASCII string containing both int and float numbers.

Tue Mar 04, 2008 8:11 pm
Display posts from previous:  Sort by  
Reply to topic   [ 2 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.