Answer the question
In order to leave comments, you need to log in
Unable to populate array with 'image name' values. How to do it correctly?
Good afternoon. I'm trying to create an array of image names. Unfortunately, I can't do it, I get this error:
Error C4996 'swprintf': function has been changed to conform with the ISO C standard, adding an extra character count parameter. To use the traditional Microsoft version, set _CRT_NON_CONFORMING_SWPRINTFS. findfile a:\projects\test\findfile\findfile\findfile.cpp 39
Here is my code;
#include "stdafx.h"
#include <stdio.h>
#include <string.h>
#include <conio.h>
#include <stdlib.h>
#include <windows.h>
#include <wchar.h>
#include <math.h>
#include <iostream>
#include <conio.h>
#include <dos.h>
#include <iomanip>
using namespace std;
int inum = 0;
void main()
{
WIN32_FIND_DATA FindFileData;
HANDLE hf;
hf = FindFirstFile(L"*.jpg", &FindFileData);
if (hf != INVALID_HANDLE_VALUE)
{
do
{
::inum++;
//std::wcout << FindFileData.cFileName << endl;
} while (FindNextFile(hf, &FindFileData) != 0);
FindClose(hf);
}
wchar_t *image_name = new wchar_t[::inum];
if (hf != INVALID_HANDLE_VALUE)
{
do
{
swprintf(image_name, FindFileData.cFileName, 1);
} while (FindNextFile(hf, &FindFileData) != 0);
FindClose(hf);
}
std::wcout << image_name[1] << endl;
std::cout << ::inum << endl;
system("pause");
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question