RE: [cc65] Get user input?

From: Raj Wurttemberg <rajw1c64.us>
Date: 2004-09-26 17:26:25
> To just get one line of input:
>         char buf [40];
>         printf ("Your input: "); fflush (stdout);
>         fgets (buf, sizeof (buf), stdin);
>         printf ("\nYour input was: %s\n", buf);

One little oddity about the above input method... It appears to also capture
the carriage return character. Is there a way to get it to not do that?
Since I do not know to much about C here is my little (noob) workaround:

 -  int crchar;
    char buf [40];
    printf ("Your input: "); fflush (stdout);
    fgets (buf, sizeof (buf), stdin);
 -  crchar = strlen(buf)-1;
 -  buf[crchar]=0;
    printf ("\nYour input was: %s\n", buf);

I basically just changed the \x13 in the string to an \x0 to mark the end of
the string in memory.

Thanks,
/*Raj*/

----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Sun Sep 26 17:26:23 2004

This archive was generated by hypermail 2.1.8 : 2004-09-26 17:26:32 CEST