|
You should break out of the loop, otherwise you will keep reading until you get to the end of the file.
while( infile.getline( szLine,256,'\n' ) )
{
if( strncmp( szLine,Database,strlen( Database ) ) == 0 )
{
DatabaseName = &szLine[strlen(Database)+1];
AfxMessageBox( DatabaseName );
<code>break;</code>
}
}
You could write this using much less code by calling GetPrivateProfileString[^]
Roger Stewart
"I Owe, I Owe, it's off to work I go..."
|
|
|
|
|
I've been having problems with this for quite a while. I found the problem now... there is an terminator character that is in the encrypted text.
I the MSDN code encrypted the file... wrote it to another which they are both the same length but when i try to read teh encrypted file to a string it stops at that position.... how can I get the whole file set to the string or show all of it in a CString?
-Steven Hicks
CPACodeProjectAddict
|
|
|
|
|
are u encrypting something and getting zero's in the middle of the data? is that what ur saying?
have u been drinking?
"there is no spoon" biz stuff about me
|
|
|
|
|
Well, it encrypts a long CString of XML, it doesn't have any special characters. It is encryted with the CryptoAPI. Writes it to a file.
(after a lot of trouble I decided to go this route, because the code on CryptoAPI does this and I couldn't get it to work with the string).
Anyways when I use CFile to read the file thats encrypted, it sees teh right length of the file but when I use Read to a char it stops at liek 236, but the read function returns the file length.
-Steven Hicks
CPACodeProjectAddict
|
|
|
|
|
what cipher function are u using?
sometimes the encrypted data can result in zero's in the data stream so u can change the cipher or (prolly better) read the file in binary mode
"there is no spoon" biz stuff about me
|
|
|
|
|
CALG_RC4
-Steven Hicks
CPACodeProjectAddict
|
|
|
|
|
another thing u can do (which is what i do) is hex encode the data after encryption ... then u know u have a valid ascii data stream
"there is no spoon" biz stuff about me
|
|
|
|
|
|
Anybody have a suggestion on how I could continue to use MFC/C++ with XML and avoid COM? I'm looking for a way to exchange XML in a robust, straight-forward fashion between my (server) process and another (server) process.
I like life. Life likes me. ( --Ghost of Christmas Present )
|
|
|
|
|
|
Thanks for trying. Unfortunately, using the CString-class breaks down quickly when a CDATA section is placed in the XML document.
|
|
|
|
|
|
I've been using XML4C quite happily with MFC for a couple years. It handles pretty much everything there is to handle in XML land. Google "XML4C" for more info. You'll find it @ IBM's site.
/ravi
Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
I will giving this a try. Thank you very much.
|
|
|
|
|
The docs say to include windows.h, but it doesnt help. Compile error with:
MENUITEMINFO miiInfo;
miiInfo.cbSize = sizeof(miiInfo);
miiInfo.fMask = MIIM_FTYPE|MIIM_ID|MIIM_STATE;
error C2065: 'MIIM_FTYPE' : undeclared identifier
Thanks,
ns
|
|
|
|
|
Try MIIM_TYPE
[Edit]
Sorry, I just looked up MIIM_TYPE in Winuser.h and found also MIIM_FTYPE is also defined there, but MIIM_FTYPE is enclosed in a #if(WINVER >= 0x0500) block. So you will have to ensure you are building for W2K or above in order for MIIM_FTYPE to be recognized by the compiler.
[/Edit]
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
|
Hi There
The scenario:
I got one Java application (server) and multiple C++ clients. The java server is always running and the C++ clients will need to communicate with it as they are started/Stopped. The data communicated is mainly XML. All this is running on the same computer.
The demands:
The communication must be platform independent, at least in the Java application (i.e. no using JNI dlls) because the Java server should run unchanged and be able to communicate with clients implemented on other architectures in the future.
The technique should be easy to work with, i.e. not too low level, and not over complicated (as I suspect CORBA is)
The question:
What communication technique/technology should I use?
The considerations:
CORBA Too complicated for the simple use?
Sockets/Pipes Too much work for the intended simple use?
XML-RPC Current my favourite. But is it too inefficient using HTTP when the communication is local?
JNI Not suited for IPC unless memory mapped files are added...correct?
XYMessenger As presented here. Might be suitable but how is it compared to XML-RPC?
Kind Regards Rene
|
|
|
|
|
My vote: Sockets.
"...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..."
Me
|
|
|
|
|
I am using ShellExecute to run a dos command.
How can I tell if the dos command failed ?
I think that WinExec might work for this but I must use ShellExecute since I have to wait for a long command to wait and I am utilizing the :
WaitForSingleObject (sei.hProcess, 0)==WAIT_TIMEOUT
Thanks,
Shay
|
|
|
|
|
Shay
How is it going?
WaitForSingleObj may not be the way to go.
Best Wishes,
Marty
Best Wishes and Happy Holiday's,
ez_way
|
|
|
|
|
I did it in a similar way and it works fine
thanks for the dedication.
|
|
|
|
|
What do you think about using CopyCallback ?
UINT CopyCallback(
HWND hwnd,
UINT wFunc,
UINT wFlags,
LPCSTR pszSrcFile,
DWORD dwSrcAttribs,
LPCSTR pszDestFile,
DWORD dwDestAttribs
);
It is part of
int SHFileOperation(LPSHFILEOPSTRUCT lpFileOp
);
Best Wishes and Happy Holiday's,
ez_way
|
|
|
|
|
Hmmmm, how exactly, can you expand ?
|
|
|
|
|
Hi I modified the mail above. Sorry I forgot to include some stuff!
I will be 55 next week or so I am slipping abit or byte.
Best Wishes and Happy Holiday's,
ez_way
|
|
|
|