Good day,
I´m newbie with Prizm calculator, but I now how to program in C.
I´m very intereted in program my Prizm with C, then I downloaded the Prizm SDK 0.3. I know how to print strings, but I do not know how to input values to a variable. Example, I´d like to calculate a rectangular area, then I need to enter the values for X and Y and my program will compute X*Y and print the area.

Any help will be appreciated.

Regards and sorry my bad English.
Here is something I wrote a while ago it is based on this wiki page http://prizm.cemetech.net/index.php/Reading_Input

Code:

void getStrn(int x,int y, char * buffer,int n){
   int start = 0; // Used for scrolling left and right
   int cursor = 0; // Cursor position
   char lowercase=0;
   buffer[0] = '\0'; // This sets the first character to \0, also represented by "", an empty string

   DisplayMBString((unsigned char*)buffer, start, cursor, x, y); // Last to parameters are X,Y coords (not in pixels)

   int key;
   while(1){
      GetKey(&key); // Blocking is GOOD.  This gets standard keys processed and, possibly, powers down the CPU while waiting
      if(key == KEY_CTRL_EXE){
         // Ok
         break;
      }else if(key == KEY_CTRL_EXIT){
         // Aborted
         break;
      }else if(key==KEY_CTRL_F1){
         lowercase^=1;
      }
      if(key && key < 30000){
         cursor = EditMBStringChar((unsigned char*)buffer, n, cursor, key);
         if(lowercase){
            if((buffer[cursor-1]>='A')&&(buffer[cursor-1]<='Z'))
               buffer[cursor-1]+='a'-'A';
         }
         DisplayMBString((unsigned char*)buffer, start, cursor, x,y);
      }else{
         EditMBStringCtrl((unsigned char*)buffer, n, &start, &cursor, &key, x, y);
      }
   }
}

Example usage:

Code:

char buf[64];
getStr(1,2,buf,64);

X must be in range of 1 to 20
Y must be in rage of 0 to 7
See http://prizm.cemetech.net/index.php/PrintXY
then this function is similar to io.read in Lua cin in c++ or scanf in C ?
No this just answers the question at hand. You use the function above then use atoi on the string to get an integer. If you need all the features of scanf, then use scanf. My fork of libfxcg has code for it but I never bothered to test it. https://github.com/ComputerNerd/libfxcg/tree/master/libc
  
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
Page 1 of 1
» All times are UTC - 5 Hours
 
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 vote in polls in this forum

 

Advertisement