Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <windows.h>
- #include <tchar.h>
- #include <io.h>
- #include <fcntl.h>
- #include <stdio.h>
- #define TAM 200
- #define MAX 256
- int _tmain(int argc, TCHAR* argv[]) {
- HKEY chave;
- TCHAR chave_nome[TAM], par_nome[TAM], par_valor[TAM], str[MAX], result[2*MAX] = TEXT("Software\\Aula\\");
- /* ... Mais variáveis ... */
- #ifdef UNICODE
- _setmode(_fileno(stdin), _O_WTEXT);
- _setmode(_fileno(stdout), _O_WTEXT);
- _setmode(_fileno(stderr), _O_WTEXT);
- #endif
- /* ... as várias alíneas ...*/
- do {
- //_tprintf(result);
- _tprintf(TEXT("\nInsert key: "));
- fflush(stdin);
- _fgetts(str, MAX, stdin);
- //Retirar \n
- str[_tcslen(str) - 1] = '\0';
- _tprintf(TEXT("%s"), str);
- _stprintf_s(result, 2 * MAX, TEXT("Software\\Aula\\%s"), str);
- _tprintf(TEXT("\n%s"), result);
- //_stprintf_s(result, MAX, TEXT("Frase:%s, Tamanho:%d\n"), str, _tcslen(str));
- RegCreateKey(HKEY_CURRENT_USER, result, &chave);
- _tprintf(TEXT("\nInsert key: "));
- fflush(stdin);
- _fgetts(par_valor, TAM, stdin);
- //Retirar \n
- par_valor[_tcslen(par_valor) - 1] = '\0';
- RegSetValue(chave, NULL, REG_SZ, par_valor, NULL);
- } while (_tcsicmp(TEXT("FIM"), str));
- RegCloseKey(chave);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement