zoukankan      html  css  js  c++  java
  • 时间作为文件名

    #include <stdio.h>
    #include <iostream>
    #include <cstring>
    #include <fstream>
    #include <winsock2.h>
    #include <opencv2/opencv.hpp>
    //#include <netlistmgr.h>
    #include <time.h>

    #pragma comment(lib, "ws2_32.lib")

    using namespace std;
    using namespace cv;


    #define PACKAGE_NUM 1
    #define IMG_WIDTH 640
    #define IMG_HEIGHT 480
    #define BLOCKSIZE IMG_WIDTH*IMG_HEIGHT*3/PACKAGE_NUM

    struct recvBuf
    {
      char buf[BLOCKSIZE];
      int flag;
    };

    char pStrPath1[220];
    int a1 = 0;
    time_t currTime;
    struct tm *mt;

    SOCKET m_Client;

    int test1();
    void RecvFile();
    //int receive(cv::Mat& image,int sockConn);
    int socketConnect(const char* IP, int PORT);
    int socketConnect2();
    Mat receiveImg(int sockConn);

    int main()
    {
      //int socketClient = socketConnect("101.6.49.97", 8899);
      int socketClient = socketConnect2();
      if (socketClient<0)
      {
        return 0;
      }

      //string Imagespath = "D:\images\5\";
      Mat img_1 = receiveImg(socketClient);

      currTime = time(NULL);
      mt = localtime(&currTime);
      sprintf(pStrPath1, "D:\images\5\%d%02d%02d%02d%02d%02d.jpg", mt->tm_year + 1900, mt->tm_mon + 1, mt->tm_mday, mt->tm_hour, mt->tm_min, mt->tm_sec);
      imwrite(pStrPath1,img_1);
      imshow("win1",img_1);

      waitKey(0);
      return 0;
    }

  • 相关阅读:
    Mysql优化
    RabbitMQ教程
    手把手Centos7 安装jenkins详细教程
    FreeMarker学习系列之一
    Vue学习之Vue模拟后台数据
    vuejs学习之新的components组件挂载
    vuejs学习之项目结构解读
    VueJS学习之Vue-cli项目模板
    菜鸟手把手学Shiro之shiro授权流程
    js基石之---es7的decorator修饰器
  • 原文地址:https://www.cnblogs.com/herd/p/10081380.html
Copyright © 2011-2022 走看看