
/*******************************************************************************
 * Copyright (c) 2005, 2009 Intel Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Hoang M. Nguyen, Intel - Simple application which uses stdin/out/err.
 *
 * $Id: SimpleAppl.c,v 1.7 2009/01/27 19:20:01 jcayne Exp $
 *
 *******************************************************************************/ 

#include <stdio.h>

#if  defined(_WIN32)
   #include <windows.h>
#elif  defined(_LINUX_X86) || defined(_LINUX_S390)
   #include <unistd.h>
#endif

int main()
{
	int count;
	int numMsgs=3;

	char  buffer[512];

	printf("SimpleAppl has started.\n");
	printf("Expect %d msgs from stdout, 1 msg from stderr, and 1 msg echoed back from stdin.\n", numMsgs) ;
	fflush(stdout);

	for (count=0; count < numMsgs; count++)
	{
		printf("SimpleApp stdout message %d.\n", count);
		fflush(stdout);

	}

	fprintf(stderr, "SimpleApp stderr message.\n");
	fflush(stderr);

	printf("SimpleApp reading from stdin...\n");
	fflush(stdout);

	gets(buffer);
	printf("SimpleApp read stdin: %s\n", buffer);
	fflush(stdout);

	printf("SimpleAppl is finished.\n");
	fflush(stdout);

	return 0 ;
}



