Click here to Skip to main content
15,886,513 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHow to access Window Procedure of another processes window Pin
User 21559723-Dec-04 23:48
User 21559723-Dec-04 23:48 
QuestionWhy I can't run my app. on Win XP? Pin
ArielR23-Dec-04 23:36
ArielR23-Dec-04 23:36 
AnswerRe: Why I can't run my app. on Win XP? Pin
Aamir Butt23-Dec-04 23:39
Aamir Butt23-Dec-04 23:39 
GeneralRe: Why I can't run my app. on Win XP? Pin
ArielR23-Dec-04 23:45
ArielR23-Dec-04 23:45 
GeneralRe: Why I can't run my app. on Win XP? Pin
Steve S24-Dec-04 0:58
Steve S24-Dec-04 0:58 
GeneralRe: Why I can't run my app. on Win XP? Pin
ArielR28-Dec-04 2:25
ArielR28-Dec-04 2:25 
Generalfstream problem Pin
Imtiaz Murtaza23-Dec-04 23:01
Imtiaz Murtaza23-Dec-04 23:01 
GeneralRe: fstream problem Pin
Andrew Walker24-Dec-04 1:06
Andrew Walker24-Dec-04 1:06 
std::ifstream isn't designed to allow the reading of the entire filesize. The function _filelength in <io.h> will give you the length of a file. Be warned that this function is limited to the size of a long, so for very large files you'll need to use a platform dependant API (See MSDN).

The following function taken from the boost::regex sample code (regex_grep_example1.cpp) is one example of how to efficiently and safely allocate space using std::string. This is not the simplest solution, it is flexible. However without profiling this is micro-optimisation that probably isn't going to help. Note the use of reserve and capacity to ensure appropriate growth system for you buffers. You may be able to tweak initial size and growth rates if you know roughly what size the file will be.

void load_file(std::string& s, std::istream& is)
{
   s.erase();
   if(is.bad()) return;
   s.reserve(is.rdbuf()->in_avail());
   char c;
   while(is.get(c))
   {
      if(s.capacity() == s.size())
         s.reserve(s.capacity() * 3);
      s.append(1, c);
   }
} 


If you can keep you head when all about you
Are losing theirs and blaming it on you;
If you can dream - and not make dreams your master;
If you can think - and not make thoughts your aim;
Yours is the Earth and everything that's in it.

Rudyard Kipling

QuestionHow to display a Message when click on a Edit Box Scroll bar ? Pin
pubududilena23-Dec-04 22:17
pubududilena23-Dec-04 22:17 
AnswerRe: How to display a Message when click on a Edit Box Scroll bar ? Pin
Aamir Butt23-Dec-04 22:31
Aamir Butt23-Dec-04 22:31 
GeneralRe: How to display a Message when click on a Edit Box Scroll bar ? Pin
pubududilena23-Dec-04 22:40
pubududilena23-Dec-04 22:40 
Questioncan i make command buttons in vc++(like vb) Pin
siva_nkl3323-Dec-04 21:47
siva_nkl3323-Dec-04 21:47 
AnswerRe: can i make command buttons in vc++(like vb) Pin
ThatsAlok23-Dec-04 22:47
ThatsAlok23-Dec-04 22:47 
Generalabout breakpoints in VC++ Pin
grace_sonal23-Dec-04 21:05
grace_sonal23-Dec-04 21:05 
GeneralRe: about breakpoints in VC++ Pin
mirex25-Dec-04 7:35
mirex25-Dec-04 7:35 
GeneralTemplate class and header files Pin
Imtiaz Murtaza23-Dec-04 19:01
Imtiaz Murtaza23-Dec-04 19:01 
GeneralRe: Template class and header files Pin
Michael Dunn23-Dec-04 21:08
sitebuilderMichael Dunn23-Dec-04 21:08 
Questionhow to call exe file in vc++ Pin
vc-programmer-23-Dec-04 17:31
vc-programmer-23-Dec-04 17:31 
AnswerRe: how to call exe file in vc++ Pin
parths23-Dec-04 18:03
parths23-Dec-04 18:03 
GeneralRe: how to call exe file in vc++ Pin
pavanbhai23-Dec-04 18:43
pavanbhai23-Dec-04 18:43 
AnswerRe: how to call exe file in vc++ Pin
Sarfraz Anwar23-Dec-04 18:18
Sarfraz Anwar23-Dec-04 18:18 
AnswerRe: how to call exe file in vc++ Pin
ThatsAlok23-Dec-04 18:21
ThatsAlok23-Dec-04 18:21 
GeneralRe: how to call exe file in vc++ Pin
Member 45151623-Dec-04 18:43
Member 45151623-Dec-04 18:43 
GeneralRe: thank...can i pass parameter Pin
vc-programmer-23-Dec-04 19:56
vc-programmer-23-Dec-04 19:56 
GeneralRe: thank...can i pass parameter Pin
Member 45151623-Dec-04 20:07
Member 45151623-Dec-04 20:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.