CEMETECH
Leading The Way To The Future
Login [Register]
Username:
Password:
Autologin:

Don't have an account? Register now to chat, post, use our tools, and much more.
Latest Headlines
Online Users
There are 116 users online: 4 members, 100 guests and 12 bots.
Members: Stardust49.
Bots: MSN/Bing (1), Spinn3r (2), Magpie Crawler (3), Googlebot (6).
RSS & Social Media
SAX
You must log in to view the SAX chat widget
This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's Technology & Calculator Open Topic subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

This forum is locked: you cannot post, reply to, or edit topics. Community News & Discuss Nspire => Technology & Calculator Open Topic
Author Message
bsl


Advanced Newbie


Joined: 09 Jan 2010
Posts: 94

Posted: 16 Jun 2010 06:04:10 pm    Post subject:

The standard file handles STDIN, STDOUT, and STDERR, are already open on the TI-Nspire .
It was a matter of a little detective work finding them.
All 3 are directed to RS232 however.

The attachment has a hand coded CAS and NONCAS proof of concept program for these handles.
The result you should get on the emulator console is:

Code:

TERMINAL> Is fgets working ?       // I entered "Is fgets working ?" and hit return
You entered:Is fgets working ?

TERMINAL>

The equivalent C program should look like this(pseudo code):

Code:

/*  terminal.c (noncas version) */

int main(void){
FILE *stdin,*stdout,*stderr;
char buffer[32];
 stdin = (FILE *) 0x105bb5f0;
 stdout = (FILE *) 0x105bb63c;
 stderr = (FILE *) 0x105bb688;
 printf("TERMINAL> ");       // terminal prompt
 fgets(buffer,32,stdin);     // get user input
 printf("You entered:%s\nTERMINAL> ",buffer);
 return 0;
}

IDEA: Include a while loop above to make a real terminal program that processes strings for commands.

printf is usefull for debugging messages to the console.
fgets used in this way can be used in development to change execution of a program during development.

The attachment also contains CAS NONCAS handle definitions and fgets definition for os.h

[attachment=3194:StdFileHandles.zip]


Last edited by Guest on 17 Jun 2010 05:25:16 pm; edited 1 time in total
Back to top
bwang


Member


Joined: 15 Mar 2009
Posts: 128

Posted: 16 Jun 2010 08:16:26 pm    Post subject:

Excellent Smile
Back to top
Display posts from previous:   
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

Go to Registration page
   
View previous topic :: View next topic  
Page 1 of 1 All times are GMT - 5 Hours

 

© Copyright 2000-2014 Cemetech & Kerm Martian :: Page Execution Time: 0.024284 seconds.