|
Perfect solution, Thanks.
Yossi Malka
|
|
|
|
|
Hi,
I am confused regarding choosing one declaration from a set of two. I could not decided which one should be preferred over other and why it should be preferred. Please see the declarations below and let me know out of (I) and (II) which declaration is more preferred and why.
(I)
#if defined (UNICODE) && defined (_UNICODE)
typedef std::wstring _tstring;
#else
typedef std::string _tstring;
#endif
(II)
#if defined (UNICODE) && defined (_UNICODE)
#define _tstring std::wstring
#else
typedef _tstring std::string;
#endif
Thanks and Regards
|
|
|
|
|
I would choose typedef . You may google a bit [^] to find comparisons.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Use the
typedef . At least typedef s are part of the language and can be constrained by the namespacing mechanisms the language has (namespace , class , struct etc).
#define s, on the other hand, have the effect of performing a global search and replace over your code, which can causes horrors to occur. The C++ FAQs say it[^] quite well.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
What is the difference between
CWaitCursor wait;
and
SetCursor(LoadCursor(NULL, IDC_WAIT));
and at what situation/ advantage and disadvantage between them
|
|
|
|
|
CWaitCurso r belongs to the MFC library.
The SetCursor that you did was Windows API calls.
MFC also has CCmdTarget::BeginWaitCursor and CCmdTarget::EndWaitCursor methods to do the same.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
I used
CWaitCursor wait;
it is working for all the dialogs but it is not working for one sigle dialog what would be the resson, Please advice
|
|
|
|
|
I would recommend the documentation [^], [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I used
CWaitCursor wait;
it is working for all the dialogs but it is not working for one sigle dialog what would be the resson, Please advice
|
|
|
|
|
if its working for all the other dialogs then why is it not working for one single window?? and what advice do you expect? how do we know what implementation have you done?
|
|
|
|
|
Hi,
The MapViewOfFile function fails when 1gb of memory is mapped , it seems the memory is not continuous which is causing the problem.
Is there any way to overcome this problem.
Thanks
|
|
|
|
|
You have to map only part of the file at a time. To load more of the file unmap the current view and map the new view.
This is an excerpt from MSDN -
For files that are larger than the address space, you can only map a small portion of the file data at one time. When the first view is complete, you can unmap it and map a new view.
To obtain the size of a view, use the VirtualQuery function.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
I have a list of domains users( ie domain\user1, domain\user2, etc.. ), and I want to share a folder for this users only.
i am tried with NetShareAdd(). and succeed to share with everyone Read permission. But I do not want to give everyone ,really want to specify the users
This is the Code block i have tried.
#define MAXLEN 256
NET_API_STATUS res;
SHARE_INFO_502 p;
DWORD parm_err = 0;
char *dir="TESTSHARE";
wchar_t shareName[MAXLEN];
mbstowcs( shareName, dir, MAXLEN );
char* remark = "TESTSHARE to test NetShareAdd";
wchar_t ShareRemark[MAXLEN];
mbstowcs( ShareRemark, remark, MAXLEN );
p.shi502_passwd = NULL;
p.shi502_permissions = ACCESS_READ;
p.shi502_netname = LPSTR(shareName);
p.shi502_type = STYPE_DISKTREE;
p.shi502_remark = LPSTR(ShareRemark);
p.shi502_max_uses = 4;
p.shi502_current_uses = 0;
res = NetShareAdd(NULL, 502, (LPBYTE) &p, &parm_err);
can Anyone one help me..
Thanks in advance
|
|
|
|
|
Hi
I need help creating a user interface which would display all the certificates stored in MyStore. I want to display certificate information such as Issued by, issued to, and expiry date in different columns and when i click a specific certificate, the certificate should open up. I was able to display all those information in the console but I don't know how to go on about doing this in a GUI. Help would be most appreciated
|
|
|
|
|
why dont you look at using a dialog and a listbox (ie, for columns) ?
there's plenty of examples of using a listbox
'g'
|
|
|
|
|
will do. thanks
|
|
|
|
|
The 32-bit "Interlocked...." functions say that their parameters must be aligned on "a 32-bit boundary," otherwise they behave unpredictably.
Do I need to worry about this in the ordinary case of declaring member variables in my C++ classes with VS 2008?
|
|
|
|
|
If you don't use #pragma pack and change the alignment to less than 4, you don't need to worry.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Thanks! I was getting worried there for a while.
|
|
|
|
|
My task is as follows...
I have 2 data files a Source (A) and a Destination (B) both located in the shared network drive.
A is a data file (plain text) between 2GB and 3GB made up of records of fixed size.
A is always being written into by other processes (new records being appended at the end).
I would like to read through the whole file A, read each record, leave what I still need and archive the rest to B.
There is a 10 character string I can use within each record as a filter.
Any tips how to go about this? Is MMF the path to take?
Thanks for any help.
----------------------------------------------------------
Lorem ipsum dolor sit amet.
|
|
|
|
|
Read it in in chunks. fopen() does that for you, but you could optimize the processing by doing it yourself. Since you are using fixed size records, this is even easier to code.
MMF is definitely NOT the way you want to do this for several reasons include the size of the file and that it's on a network resource.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
actually, i am using MMF for this reason (the size of the file). With MMF, I can specify in MapViewOfFile which part of the file to load, instead of opening the file the usual way which loads the whole file in memory. Also, I can just write to the file via the mapped region of memory directly. This would be tricky in the usual way as I have to remove records in place (meaning if a record does not fit the filter, i have to write in its place the next record that does.)
----------------------------------------------------------
Lorem ipsum dolor sit amet.
|
|
|
|
|
Since you are reading sections of the file sequentially, memory mapped files offer zero benefit. Since shifting the window of the memory mapping requires operations, you are making the program slower for no reason. I fail to see how this is tricky using multiple buffers and straight I/O.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
maybe i'm missing something but it is mainly for the operations i am performing to file A which is large.
say, i partition file A in blocks of 64kb. i read block1 and filter those records i am not interested in. i write back to this same block1 those i want to keep. when i am finished with this block, i move to the next block2. i may still be not done writing to block1 because i will always be interested in less than or equal records to the original.
therefore i have 2 mapviews of fileA, view1 is just reading which is always the same or advanced in the file as view2 which writes back.
the other point i think MMF is useful is the fact the file is too large as to load entirely in memory via the usual file open operations. i hope i make sense to you? do you still think i could do this same as or better with usual fopen?
----------------------------------------------------------
Lorem ipsum dolor sit amet.
|
|
|
|
|
I understand what you're doing and still wonder why you don't just use CreateFile() and two buffers?
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|