Scanf is not working in posix sample

Jason Davis Jason.Davis at gmx.net
Fri May 20 20:42:06 UTC 2005


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?

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)




More information about the users mailing list