Compact 2013 Ebook

14.5 C Libraries
Created by djones on 6/18/2013 7:34:08 AM

C Libraries

Various APIs are available to native code including the standard C libraries. The header file stdio.h is actually used by the project as it is referenced stdafx.h. To make the application more interesting and to demonstrate this lets add some code to display the local time.

1. Modify the program to:

// Hello.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
int _tmain(int argc, TCHAR *argv, TCHAR *envp)
{
	_tprintf(_T("The time is: "));
	//Get the system time
	SYSTEMTIME st;
	GetLocalTime(&st);
	//Display the time in a formatted string
	TCHAR dateTime[100];  //The buffer for the DateTime string
	_stprintf
		(dateTime,
		_T("Time  %02d:%02d:%02d Date [DD/MM/YYY] %02d/%02d/%04d\n"),
		st.wHour,st.wMinute,st.wSecond, st.wDay, 
		st.wMonth, st.wYear
		);
	_putts(dateTime);
	TCHAR ch;
	_tprintf(_T("Press enter to continue:\n"));
	_getts(&ch);
	return 0;
}

Listing 14.5 Console application to get and output the Local Time

2. Build and run the app:

clip_image002

Figure 14.12: Hello console application displaying local time output on the target device.

The C Standard Library can be used with Windows Embedded Compact native code. Also the Standard Template Library is available and has had some updates with Compact 2013.


NEXT:  Native Code Win32 Forms Application Development

print

Click here to provide feedback and input

  Comments

There is no comment.

Turkish porno izle video site in rokettubeporno izle