|
|
Vaclav_Sal wrote: You computing geeks or in this case morons could use break once in a "blue moon"!
There is a lounge for casual dialog. If you weren't such a moron, you could read the list of forums across the top.
And "you computing geeks"... Nice, but since you're here too, what exactly does that make you?
|
|
|
|
|
Are you officially back?
__________________________
Don't drink and derive.
Alcohol and calculus don't mix.
|
|
|
|
|
Well, I never really left. I just no longer deal with the lounge and soapbox. Although, that may not have been apparent, by my, ahem, going out post.
|
|
|
|
|
CP has a lounge.
Jemmy : Deadline? Pfft, a real programmer eats deadlines for breakfast. :P
Mark: I thought real programmers ignored deadlines
Best wishes to Rexx[^]
|
|
|
|
|
Well each thread on the language forums is a question that relative to that forum but The Lounge forum is for these objects;).(But anyway I think it must a good day )
|
|
|
|
|
Hi,
Pls tell me a STL data structure, by which I can implement Least Recently Used algorithm.
i.e. Each time a request comes to a ID, I will update the Hit count, when I have to delete an entry
I can get the one with Lowest Hit Count (Least Recently Used ). With map I have to iterate through all elements & find the one with Lowest Count? Is ther any other data structure which will directly retreive the ID with Lowest Hit Count.
Thanks in Advance,
Vinod.C.S
|
|
|
|
|
I don't think there is such a structure in the STL. You could check out the Boost Library[^] to see if there's one there or write your own either based on stl structures or from scratch.
If you do then be sure to post it on Code Project so we can all benefit. That's if there isn't one knocking around here already. Have you checked the Articles?
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Hi all,
In VC++.NET how to merge an string with a Pointer. For example,
TCHAR* serial_key ="some text";
mycommand=new SqlCommand ( "Select id from validate where value='"+ serial_key +"'",mySQLConnection ) ;
I am declaring the serial_key as TCHAR * from some purpose. So changing it's type is difficult for me
Thanks in advance
Know is Drop, Unknown is Ocean
|
|
|
|
|
it's not a string with a pointer that you merge, but a string with a C-Style string which first character is pointed to by your pointer.
have a look at the _tcscat() CRT function to concatenate your strings...
|
|
|
|
|
strcat with TCHAR ? You're looking for troubles
|
|
|
|
|
OMG, i didn't see it was TCHAR strings... lol.
thanks anyway, i fixed my post.
|
|
|
|
|
You cannot add two strings together this way (you will just add the two addresses). Instead, you should use _tcscat macro which resolve to strcat if no unicode is declared or to wcscat if unicode is defined. See here[^].
|
|
|
|
|
how to read and display the text file data instanously and update(display one data at a time), whereas the text file is being written at runtime by the vc++ pgm
|
|
|
|
|
suganforu wrote: how to read and display the text file data instanously and update(display one data at a time), whereas the text file is being written at runtime by the vc++ pgm
do you think we're idiots ?
it's not because your question goes on the 2nd page like we don't see it anymore, and that you deleted your post that the answers don't remain the same :
NO, YOU CAN'T ![^]
you have to read the file first.
|
|
|
|
|
You got to read the file and display regularly. Setting up a timer may help.
If it is possible you can compare the file size or file time to check for changes.
Greetings from Germany
|
|
|
|
|
|
It sounds like what you want is live display of file contents in real time. Technically that is impossible but in practice if you back off your requirements a little you may be able to get it to work.
There are two basic approaches:-
1 A loop which reads the file, displays the contents and pauses for a short time then goes round again. Depending on the size of the file and complexity of the display you may be able to get several updates per second or an update every few seconds. Either way your processor usage is liekly to be 90%+ and unhappiness may result.
2 Read the file once and display it. Then register for File Change Notifications from the operating system and when you get one that relates to the file you're interested in re-read and re-display it. This is more code and less portable but probably a better way to go.
If data integrity is an issue you're going to need to lock the file while reading it, unlock it when you're finished and perhaps carefully synchronise your usage. Other tricks like reading large blocks at a time from the file that match the native file block sizes, temporarily boosting the priority of the reader thread etc could be used to improve the overall effectiveness but in the end this is not a job which fits comfortably with the machine architectures we have inherited from the days of batch processing and single threaded operation.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
You can read file update its values and then return this new values to file but answer to your question is no.
|
|
|
|
|
hello,
I remember reading once that a CString object has a maximum amount of characters it can hold, I just can't seem to find how much that is.
Does anybody know how much that count is? If you have a URL with that info that would also be neat.
Greetings,
Davy
|
|
|
|
|
sure, check it's index type... you'll figure out how far it can go (so, how many TCHARs a CString can hold)
|
|
|
|
|
From memory 32767. Two things to note-
The best way to confirm this is to look at the CString source.
The other thing that doing this will confirm for you is that if you're going anywhere near needing to know what the limit is you shouldn't be using CStrings. A preallocated 32K or 64K character buffer will likely be serveral times faster, depending on what you're doing with it of course, and the Win32 API and MSVCRT have a vast array of string functions that operate directly on character arrays. Good luck.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
are you sticking to Windows 3.1 with MFC 3 ??
and suggest to use std::string rather than allocating a 32K buffer ! WTF !!!
|
|
|
|
|
std::string is fine if you don't care how the code you're using works. To most developers it's still unreadable gibberish with inadequate usage documentation of precisely the 'how much can it hold' type that the OP is interested in. I code on everything from Windows 3.11 to Vista and on CE in what is still, essentially, MFC 3, have written my own replacement CString class and have written a commercial inline parser generator which uses preallocated 64K text buffers, simple, reliable, consistent, fast and easy to understand. So yes if someone is struggling with determining a size limit from the CString code and dealing with 32K+ lumps of text data then I think simple buffers are good advice. KISS was the first and last thing my C++ lecturers ever taught me.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Thanks for the reply.
The required space is luckily not really near the 32K. It's just that I have a bug with some rather big strings 9+K not passing over a socket connection and I just wanted to make sure that the CString was not the cause of it.
Greetings,
Davy
|
|
|
|