0
Well, I’m passing some codes I have, and I’m doubtful I can pass that code to c, and I’d like help from anyone who can help, in the following code below
#include <dirent.h>
#include <cstdlib>
#include <iostream>
#include <string.h>
#include <windows.h>
bool extracoes();
int main()
{
bool saida;
//"Interface"
saida = extracoes();
if(saida)
std::cout<<"Copias concluidas!!!\n\nPressione qualquer tecla para encerrar!";
else
std::cout<<"Erro! Executar instalacao como Suporte\n\nPressione qualquer tecla para encerrar...";
std::cin.get();
}
bool extracoes()
{
struct dirent *lsdir;
DIR *dir;
int qtd=0, i=0;
bool padrao;
std::string path;
dir = opendir("D:\\Users\\");
while((lsdir = readdir(dir)) != NULL)
qtd++;
std::string users[qtd];
closedir(dir);
dir=opendir("D:\\Users\\");
while((lsdir = readdir(dir)) != NULL)
{
padrao=true;
std::string aux = lsdir->d_name;
if(aux.size() == 7)
{
for(int j=0; j<7; j++)
{
if(!(aux[j]<=57 && aux[j]>=48))
{
padrao=false;
break;
}
}
}
else
padrao=false;
if(padrao)
{
users[i]=aux;
i++;
}
}
closedir(dir);
users[i] = "Default";
users[i+1] = "\0";
i = 0;
padrao = true;
//Config Global
if(system("Xcopy kds_kodak c:\\ProgramData\\kds_kodak /v /e /y /h > nul") == 0)
std::cout<<"Extracao Config_Globais concluida\n\n";
else
{
padrao = false;
std::cout<<"Erro na extracao Config_Globais\n";
}
//Config default e usuários
while(users[i].compare("\0"))
{
std::cout<<"Copiando...\n";
path = "Xcopy \"Smart Touch\" \"d:\\Users\\";
path += users[i]+"\\AppData\\Local\\Smart Touch\\\" /v /e /y /h > nul";
if(system(path.c_str()) == 0)
std::cout<<"Copia do usuario "<<users[i]<<" concluida!!\n\n";
else
{
std::cout<<"Copia do usuario "<<users[i]<<" nao concluida!!\n\n";
padrao = false;
}
i++;
}
return padrao;
std::cin.get();
}
You want an equivalent code in C# or you want a tool that does this conversion for you?
– Leonel Sanches da Silva
if possible an equivalent code, because this application copies a folder of files looking for all the users it has in a user with 7 digits that would be the matricula, but done everything in prompt. But if in c# we could do another method that copies such folder placed in the root of the executable for such a place as it is in the code would also serve
– SNOT
This question seems to be decontextualized because it is a ready code request.
– user7261