Scanf is not working in posix sample

Joel Sherrill <joel@OARcorp.com> joel.sherrill at OARcorp.com
Sun May 22 22:28:58 UTC 2005


Jason Davis wrote:
> Hello,
> 
> I modified a posix printf example slightly with an additional scanf. But I
> can't figure out why the program is not running. It starts and shows the
> printf "Hello World" string but the it stops without any possible input via
> keyboard. I'm using a PC board with a PIII.
> 
> I added the test.c file and my makefile below. Any ideas?

Is there any chance the keyboard is polled and you need to enable the
clock tick driver?

--joel


> Regards,
> Jason
> 
> The test.c file:
> 
> /*
>  *  Simple test program -- simplified version of sample test hello.
>  */
> 
> #include <bsp.h>
> 
> #include <stdlib.h>
> #include <stdio.h>
> #include <stdlib.h>
> 
> void *POSIX_Init(
>   void *argument
> )
> {
>   int nummer;
>   printf( "\n\n*** HELLO WORLD TEST ***\n" );
>   printf( "Hello World\n" );
>   scanf("Eingabe: %d",&nummer);
>   printf( "*** END OF HELLO WORLD TEST ***\n" );
>   exit( 0 );
> }
> 
> /* configuration information */
> 
> #define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
> 
> #define CONFIGURE_POSIX_INIT_THREAD_TABLE
> 
> #define CONFIGURE_MAXIMUM_POSIX_THREADS 2
> 
> #define CONFIGURE_INIT
> 
> #include <confdefs.h>
> 
> /* end of file */
> 
> And my makefile:
> 
> #
> #  Makefile
> #
> 
> #
> #  RTEMS_MAKEFILE_PATH is typically set in an environment variable #
> 
> EXEC=hello.exe
> PGM=${ARCH}/$(EXEC)
> 
> # optional managers required
> MANAGERS=io
> 
> # C source names
> CSRCS = test.c
> COBJS_ = $(CSRCS:.c=.o)
> COBJS = $(COBJS_:%=${ARCH}/%)
> 
> # C++ source names
> CXXSRCS =
> CXXOBJS_ = $(CXXSRCS:.cc=.o)
> CXXOBJS = $(CXXOBJS_:%=${ARCH}/%)
> 
> # AS source names
> ASSRCS =
> ASOBJS_ = $(ASSRCS:.s=.o)
> ASOBJS = $(ASOBJS_:%=${ARCH}/%)
> 
> # Libraries
> LIBS = -lrtemsall -lc
> 
> include $(RTEMS_MAKEFILE_PATH)/Makefile.inc
> 
> include $(RTEMS_CUSTOM)
> include $(PROJECT_ROOT)/make/leaf.cfg
> 
> OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS)
> 
> all:    ${ARCH} $(PGM)
> 
> $(PGM): $(OBJS)
> 	$(make-exe)
> 
> j:
> 	@echo $(CFLAGS_DEBUG_V)
> 	@echo $(RTEMS_USE_GCC272)
> 


-- 
Joel Sherrill, Ph.D.             Director of Research & Development
joel at OARcorp.com                 On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
    Support Available             (256) 722-9985




More information about the users mailing list