|
I think you are trying to solve the wrong problem...
Why not do a base64 encoding of the encrypted password?
"was wir auch tun, wohin wir gehen
die illuminaten sind im system
sie kontrollieren überall
und 23 ist ihre zahl!"
23, welle: erdball
|
|
|
|
|
Hi, thanks for the reply. Sorry but I'm a bit of a C++ hack - ie. I'm a self-taught novice - so I'm not really sure what you mean. I've been doing a search on "base64 encoding" but can't seem to find anything that will help. Presumably this would put it into some form that could be placed in my INI file? If you could give me any advice on how to go about this I'd be really appreciative.
Thanks,
Keith
|
|
|
|
|
|
Why not store the encrypted password as a binary value in the registry?
Dave
|
|
|
|
|
Hi, thanks for the reply. I prefer to use an INI file (I'm using an INI file for all of the other settings anyway) - to be honest I've never really used the registry in my programming anyway, as I'm pretty much a hack - and a novice - when it comes to C++.
Many thanks,
Keith
|
|
|
|
|
GetPrivateProfileString is EVIL. As you have found out, it has severe restrictions on 9X. It won't work at all if your INI file gets bigger than 64K.
It is not that difficult to write your own file routines to read an INI file, line by line, and do whatever you want with it. That's the approach I would use.
You can pick your friends, and you can pick your nose, but you can't pick your friend's nose.
|
|
|
|
|
this is not a soln. to ur problem. infact i'm askin for some help.
i'm also storing the passwords in ini files, but i've no idea how to encrypt and decrypt in my prog.
can u share some code with me
thanx and regards
|
|
|
|
|
Hi,
I am developing an MFC application on VC++ .Net with HTMLHelp generated by the AppWizard. I am looking to have context-sensitive help, much of which was generated by the wizard, but I find I have to add bits regarding menu options or toolbar options I have added on later.
I have invoked the help as follows:
ON_COMMAND(ID_CONTEXT_HELP, CFrameWnd::OnContextHelp)
I have included the helpfiles for each option in the HTMLHelp project file alias:
ID_LPS_DELETE = hid_record_delete.htm
I have included their definitions in a header file HTMLDefines.h:
#define ID_LPS_DELETE 32792
I have included the header file in the map section of the project file:
[MAP]
#include HTMLDefines.h
With all of the above I am looking to have the help window come up automatically showing the correct Help page when you drag the Help icon onto a menu option, or press F1while highlighting a menu option. But I just get a message saying "Failed to launch Help".
What am I doing wrong??? All help appreciated,
Trimtrom
|
|
|
|
|
I have derived a class from fstream and my problem is that I can't write after I've read from the file.
My class looks like this:
class CLogBook : public fstream
{
public:
CLogBook();
~CLogBook() { close(); };
void SaveLogData();
void ReadLogData(string&);
int& ErrorCode() { return m_errorCode; };
string& ErrorMessage() { return m_errorMessage; };
string& Extra() { return m_extra; };
private:
string m_errorMessage;
int m_errorCode;
string m_extra;
};
SaveLogData() just formats a string and calls write(...) .
ReadLogData look like this:
void CLogBook::ReadLogData(string& data)
{
data.clear();
seekg(0);
while(!eof())
{
char* temp = new char[1024];
getline(temp, 1024, '\n');
data.append(temp);
data.append("\n");
delete [] temp;
}
}
and my test code looks like this:
CLogBook dummy;
dummy.open("test.txt", ios_base::in | ios_base::out | ios_base::app);
dummy.ErrorCode() = 123;
dummy.ErrorMessage() = "Error occured in your brain.. please RTFM!";
dummy.Extra() = "WinMain";
dummy.SaveLogData();
string buf("");
dummy.ReadLogData(buf);
MessageBox(NULL, buf.c_str(), "", MB_OK);
dummy.ErrorCode() = 666;
dummy.ErrorMessage() = "never written words";
dummy.Extra() = "BASIC SUCKS";
I hope I've got everything here... hope you can help!
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
I thought an fstream should be closed for reading before you try to write to it. I could be wrong, of course...
Christian
NO MATTER HOW MUCH BIG IS THE WORD SIZE ,THE DATA MUCT BE TRANSPORTED INTO THE CPU. - Vinod Sharma
Anonymous wrote:
OK. I read a c++ book. Or...a bit of it anyway. I'm sick of that evil looking console window.
I think you are a good candidate for Visual Basic. - Nemanja Trifunovic
|
|
|
|
|
I tried this:
CLogBook dummy;
dummy.open("test.txt", ios_base::in | ios_base::out | ios_base::app);
dummy.ErrorCode() = 123;
dummy.ErrorMessage() = "erro error error";
dummy.Extra() = "WinMain";
dummy.SaveLogData();
dummy.close();
dummy.open("test.txt", ios_base::in | ios_base::out | ios_base::app);
string buf("");
dummy.ReadLogData(buf);
MessageBox(NULL, buf.c_str(), "", MB_OK);
dummy.ErrorCode() = 666;
dummy.ErrorMessage() = "yadda yadda";
dummy.Extra() = "Linux";
As you can read from the comments, it didn't work...
I must be somewhere else or what have I done wrong.... am I using the fstream wron or what?
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
Try calling clear() before attempting to write.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
nope...
I've also tried flush() with no success...
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
The following piece of code, modelled after yours, does write everything as intended:
#include <fstream>
#include <iostream>
#include <windows.h>
#include <string>
using namespace std;
class CLogBook : public fstream
{
public:
CLogBook(){}
~CLogBook(){ close(); }
void SaveLogData()
{
clear();
write(ErrorMessage().c_str(),ErrorMessage().size());
}
void ReadLogData(string& data)
{
seekg(0);
while(!eof()) {
char* temp = new char[1024];
getline(temp, 1024, '\n');
data.append(temp);
data.append("\n");
delete [] temp;
}
}
int& ErrorCode() { return m_errorCode; };
string& ErrorMessage() { return m_errorMessage; };
string& Extra() { return m_extra; };
private:
string m_errorMessage;
int m_errorCode;
string m_extra;
};
int main()
{
CLogBook dummy;
dummy.open("test.txt", ios_base::in | ios_base::out | ios_base::app);
dummy.ErrorCode() = 123;
dummy.ErrorMessage() = "Error occured in your brain.. please RTFM!";
dummy.Extra() = "WinMain";
dummy.SaveLogData();
string buf("");
dummy.ReadLogData(buf);
MessageBox(NULL, buf.c_str(), "", MB_OK);
dummy.ErrorCode() = 666;
dummy.ErrorMessage() = "never written words";
dummy.Extra() = "BASIC SUCKS";
dummy.SaveLogData();
return 0;
}
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Aah!
Now I see what you meant... thanks, it works now!
ps. Would you/anyone be nice and tell me what you think of the class design?
it's not a big class but anyway!?
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
One last qestion for now In VC++6 I have a MFC App that is a dialog based application that I have added a menu to. All of these menus have the mnemonics added in the caption &File E&xit... But none of these show up when the program is run. Is there something basic I am forgetting to do or set? It's under Windows XP so I don't know if that makes a difference or not.
Thanks for any info!
|
|
|
|
|
Under the display settings for Windows XP there is an option (on by default) which hides the shortcut keys until you hold down the Alt key.
Dave
|
|
|
|
|
Thanks, Thats weird that I never noticed it until I was working on my own app. Oh well thanks for the info!
|
|
|
|
|
I'm trying to figure out how to sort the date based on the short date format.
ie yyyy mm dd and dd mm yyyy. Any ideas.
Thanks
|
|
|
|
|
Make both YYYY MM DD, in crude pseudo code
wsprintf(szBuffer, "%04d%02d%02d", yyyy,mm,ddd);<br />
lDate = atol(szBuffer; )
The smalest number is the earliest date, the largest is the latest date. Or using M$ convert to COleDateTime format
If I have seen further it is by standing on the shoulders of Giants. - Isaac Newton 1676
|
|
|
|
|
Does anyone have or know where I might be able to find like a quick reference card of shortcuts for VC++6 It would be really handy to have so I didn't know if there's one out there. I don't know if one comes with it cause we just have a site license at work so I don't have any manuals in front of me.
|
|
|
|
|
Help -> Keyboard Map
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
I an application I am writing, I created several floating dialog bars. The problem is, that they all have the same title in the title bar. How can I create multiple floating Dialog Bars that have different titles?
-- Steve
|
|
|
|
|
CDialogBar bar;
bar.SetWindowText("My title");
I would expect it to be that simple. Tell me if not.
~RaGE();
|
|
|
|
|
I thought that it would be simple like that too. It just named all the floating dailog bars whatever I typed in the last time I called SetWindowText().
-- Steve
|
|
|
|