|
Hi,
Thanks for your message. I am just trying to store a encoded XMl file data into the string..so that I do not need to decode it any time..and make it physically available to the user..hence I need to store the data into a string. But after a limit it stops appending the data to the string, I hope there cannot be any NULL into a XML file. When i try to decode it, the file is decoded successfully and hence it is in proper XML format..but when i try to store the same data into string it just stops at a point..here is the piece of code i am using..
CString S;
CString XML;
XML=S;
CFile inFile;
BYTE con[65535];
CFile outFile;
if(!inFile.Open(inFilePath,CFile::modeRead|CFile::shareDenyNone)) return "Error";
if(!outFile.Open(outFilePath,CFile::modeCreate|CFile::modeWrite)) return false;
CArchive ar(&inFile,CArchive::load);
BYTE Result[57+1];
while(ar.ReadString(S)) {
char Len=Decode(Result,S);
XML+=Result;
// MessageBox(NULL,XML,"XML",MB_OK);
outFile.Write(Result, Len);
}
return XML;
Please help..Thanks a lot in advance..My data in XML is around 1 MB..the file size id 1.2 MB nearly..
Regards
Himanshu
|
|
|
|
|
I have Visual C++ 6.0 and would like to port my app to the Pocket PC. Which studio/compiler do I need for this?
|
|
|
|
|
|
I finally found it and installed it. Have you installed the embedded visual tools yourself? I can not get it to run under Windows XP Pro getting the error message: failed to connect the drop-in CPU database. Do you have any idea what this is refering to?
|
|
|
|
|
I have to Map the objects with combined key which forms unique keys.
How can i use CMap with 2 compined key??
I thought of placing those 2 keys as structure and using it.
If i use structure or class as a key , Will the efficiency will be better than comparing say searching of those values in CArray.
How CMap will behave in this case??. I guess the CMap will not be much better in this case. If i lookup for the key , they should also search interally & find the values.Correct me if am wrong.
Let me know, Is there any other way to Map the object with multiple ent key?
For eg:
typedef struct {
int no;
CString Name;
}Key;
CMap<key,key,cstring,cstring> m_myMap;
Thanks & regards,
Uma
|
|
|
|
|
CMap is ok, STL is better....
CMap uses hashbuckets, efficency based on size of the data, hash alg, etc etc etc..
Multiple keys can be achived by multiple maps with <keyx, pointer="" to="" the="" object="">. You can reduce initialize penalty, by initializing maps as needed..
Brian
|
|
|
|
|
hi,
i need to display the printer status. whether it is connected or switched on or not. there is any api call or mfc call for this. share with me. any one help to me.
thanks in advance.
Murali.M
|
|
|
|
|
There aren't any good way to get printer status in windows with most print drivers....
1) First 2k, and XP does not poll printer status unless you submit a job.
2) GetPrinter return status success even if printer turned off
3) Let's say you submited job... and do something like GetJob....
- Error reported after ~60 seconds
- Most print drivers will only report "printer out of paper" as universal error, printer offline / opened / low inc -> "out of paper".
- Now let's say spooler returned status printed and job removed from the job queue. It really means nothing. Printer buffers are so large these days your entire job could be spooled to printer buffer before printer even tried to print.
- You detected somewhat error in the print queue, and decided to cancel the job... it takes about 90 seconds to cancel print job... If during those 90 seconds error condition is fixed, job will be printed anyway...
I wrote some code in the past for "secured & guaranted" check printing and it was a pain ... Had to exclude number of printers ( badly written drivers )...
Also AddMonitor is helpfull but only for local printing....
|
|
|
|
|
Hi,
I have 1 server and want to connect up to 10 remote clients.
If they are connnected, how can I send something to client x?
So no broadcast to all, just to one specific client.
I know this is how, but how can I nog which client has which connection?
ServerSocket->Socket->Connections[i]->SendText(SomeBuffer);
G.Milos(Borland Builder 6).
|
|
|
|
|
I have now one hell of a project going, about 5 meg of source code alone. I have a small problem. (well honestly a few bugs) I cannot figure out why this is happening. I have docking control bars, like in the file, http://www.codeproject.com/docking/sizecbar.asp I also have a window that allows for me to have an outlock style control bar like on this page http://www.codeproject.com/miscctrl/outbar2.asp?target=outlookbar the problem is... when I dock a control bar at the bottom of the screen, it ends up under the status bar. Raising the status bar to the mid of the screen, what could I be doing wrong? And how can I prevent this?
LOSTTWARE.com
|
|
|
|
|
After further review, I realized that other people using the Docking control bars were also haveing this same problem, with the docking control bar going under the status bar when it is on the bottom. Any one know of a way around this?
LOSTTWARE.com
|
|
|
|
|
It sames that u should initialize status bar before initializing ur docking views in CMainFrame::OnCreate().
I'm a student in China, and have been learning PC for 7 years. But till now, I'm still a learner.
|
|
|
|
|
Thank you, that worked.
LOSTTWARE.com
|
|
|
|
|
Is there anyway I can know when a file (whose name I know only) is opened or closed?
Using hooks or something...? Does windows maybe send a WM_CLOSEFILE message when you use windows API? I guess that wouldn't work incase someone used crt functions
ANyways...if anyone knows of a way I can get file status...i'd appreciate it...thanks
Cheers
The word of the day is legs, let's go back to my house and spread the word
|
|
|
|
|
You should try opening the file, by the error status you can determine all the things about the file.... if no error, you have the file opened, you can use it.
The World is getting smaller and so are the people.
|
|
|
|
|
I'll look into it, thanks
The word of the day is legs, let's go back to my house and spread the word
|
|
|
|
|
Take a look at ReadDirectoryChanges in MSDN.
With this function you can monitor a directory for file changes, and you can also receive info about which file has changed. Watch for FILE_NOTIFY_CHANGE_LAST_ACCESS
Peter Molnar
|
|
|
|
|
if you use ifstream try if ( YourFile.is_open() ) // bla bla bla
|
|
|
|
|
Ok, I've set up my dialog-based mfc app to start up the main window as a modeless dialog. Now in my OnInitDialog function, I need to be able to exit the entire program, depending on the outcome of a test I do. What would be the best way to do this?
Thanks,
Dave
|
|
|
|
|
Just return FALSE, you app will terminate before it is poped.
The World is getting smaller and so are the people.
|
|
|
|
|
|
char chr[100];
strcpy( chr, "oh,my god,give u a long word" );
chr[5] = '\0';
Joise is a C++ fun!
|
|
|
|
|
No - the array has been allocated on the stack, so there is no need to delete it (in fact deleting it is an error).
Dave
http://www.cloudsofheaven.org
|
|
|
|
|
thx so much,i know it now
Joise is a C++ fun!
|
|
|
|
|
No it is not possible to have a leak, char[100] allocate memory on the stack, when you exit function memory will be simply popped.
In fact if you had allocated memory with:
a = malloc(100); a[1] = NULL; free(a);
you would not be leaking, de-allocator knows what size you allocated.
|
|
|
|