opencv&c++

雨燕双飞 提交于 2019-12-02 06:50:57

system()

相关函数:fork, execve, waitpid, popen头文件:#include <stdlib.h>定义函数:int system(const char * string);
system(“pause”)可以实现冻结屏幕,便于观察程序的执行结果;system(“CLS”)可以实现清屏操作。而调用color函数可以改变控制台的前景色和背景,具体参数在下面说明。
例如,用 system(“color 0A”); 其中color后面的0是背景色代号,A是前景色代号。各颜色代码如下:
0=黑色 1=蓝色 2=绿色 3=湖蓝色 4=红色 5=紫色 6=黄色 7=白色 8=灰色 9=淡蓝色 A=淡绿色 B=淡浅绿色 C=淡红色 D=淡紫色 E=淡黄色 F=亮白色

FileStorage类

filestorage类

time_t

数据类型,time_t的类型是8字节的有符号整数。
包含文件:<time.h>。在time.h头文件中,我们还可以看到一些函数,它们都是以time_t为参数类型或返回值类型的函数:

double difftime(time_t time1, time_t time0);
time_t mktime(struct tm * timeptr);
time_t time(time_t * timer);
char * asctime(const struct tm * timeptr);
char * ctime(const time_t *timer);

时间函数:将结构中的信息转换为真实世界的时间,以字符串的形式显示
#include <time.h>
char asctime(const struct tm timeptr);

直接把time_t类型的转换为我们常见的格式:

/* gettime2.c*/
#include <time.h>

int main()
{
    time_t timep;
   
    time(&timep); /*获取time_t类型当前时间*/   
    /*转换为常见的字符串:Fri Jan 11 17:04:08 2008*/
    printf("%s", ctime(&timep));
    return 0;
}

编译运行

$gcc -o gettime2 gettime2.c
$./gettime2
Sat Jan 12 01:25:29 2008

转载自:https://www.runoob.com/w3cnote/cpp-time_t.html

asctime

函数原型char* asctime (const struct tm * timeptr)。
把timeptr指向的tm结构体中储存的时间转换为字符串,返回的字符串格式为:Www Mmm dd hh:mm:ss yyyy。其中Www为星期;Mmm为月份;dd为日;hh为时;mm为分;ss为秒;yyyy为年份。

/* asctime example */
#include <stdio.h>      /* printf */
#include <time.h>       /* time_t, struct tm, time, localtime, asctime */
 
int main ()
{
    time_t rawtime;
    struct tm * timeinfo;
 
    time ( &rawtime );
    timeinfo = localtime ( &rawtime );
    printf ( "The current date/time is: %s", asctime (timeinfo) );
 
    return 0;
}

编译结果

The current date/time is: Wed Feb 13 15:46:11 2013
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!