开发环境:Windows 10/Visual Studio Code 1.38.1/AliOS-Studio 0.11.2。
步骤:
1、选择编码-通过编码保存-Simplified Chinese GB2312或GBK,保存helloworld.c;
2、再次以utf-8打开helloworld.c会乱码,不影响编译输出中文,可以用Simplified Chinese GB2312或GBK编码重新打开,则helloworld.c显示正常。
/*
* Copyright (C) 2015-2017 Alibaba Group Holding Limited
*/
#include <stdio.h>
#include <aos/kernel.h>
int application_start(int argc, char *argv[])
{
int count = 0;
printf("nano entry here!\r\n");
while(1) {
printf("你好,世界!第 %d 次\r\n", count++);
aos_msleep(1000);
};
}
编译、烧录、连接串口,将输出以下内容:
Welcome to AliOS Things
nano entry here!
你好,世界!第 0 次
你好,世界!第 1 次
你好,世界!第 2 次
你好,世界!第 3 次
你好,世界!第 4 次
你好,世界!第 5 次
你好,世界!第 6 次