|
Programm3r wrote: I would like to know how I can make use of ofstream to count the total lines within a file
Probably you need a istream .
Anyway you have to loop inside the file.
Using istream::getline may help.
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.
|
|
|
|
|
Thanks for the response CPallini ....
Like I said, I know one can do it in a loop. I.E
std::ifstream inFile;
inFile.open(lpfname, std::ios::in);
while (!inFile.eof())
{
inFile.getline(Str,STRING_SIZE);
lpzLineCounter++;
}
inFile.close();
Isn't there a single function that can perform the above code while using the fstream class??
Thanks in advance
Regards,
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|
|
Programm3r wrote: Isn't there a single function that can perform the above code while using the fstream class??
No (AFAIK).
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.
|
|
|
|
|
what about using the count_if()[^] algorithm with '\n' ?
|
|
|
|
|
I bet internally, though, that it uses a loop!
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
oh, yeah, certainly... but from our side, it's much simpler to write, so why bother, eh ?!
|
|
|
|
|
you will need to use ifstream and do the work yourself!
Yours Truly, The One and Only!
|
|
|
|
|
i want to use excel in my program, so i import mso97.dll. But i get an error:fatal error mso97.dll not found.
Kindly help!!.
|
|
|
|
|
Sammyuk wrote: But i get an error:fatal error mso97.dll not found.
Kindly help!!.
Does mso97.dll exist on your machine?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
You import this file to your project but this error shows that you dont have this file on your system?
|
|
|
|
|
Kindly tell me as, is there any function to find the install path of MSOffice/Microsoft VC++. I tried SHGetFolderPath but in vain.
|
|
|
|
|
You could look in HKLM\SOFTWARE\Microsoft\Office\11.0\Common\InstallRoot, assuming you are using Office 2003.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
harsha u wrote: I have to create a CFont object,with a perticulat size in points, of a perticular face type. I also want to specify the weight (Bold or not).
I have created a font using CFont::CreateFont(). But then i have to pass the size in terms of height and width (not in pt). I need to specify the size in pt.
Actually, it is very difficult to understand , what you are saying.
Probably, you can have a look at LOGFONT .
harsha u wrote: I have also tried this:
CFont *font;
font->CreatePointFont(120,"Arial",this->GetDC());
It is throwing an exception
It is because, you are using uninitialized pointer.
Prasad
MS MVP - VC++
|
|
|
|
|
I am new to VS2005.I am facing this error message and the application closes. Can i want to know what causes this error and what is the solution
S.Yamini
|
|
|
|
|
Yes: start your debugger and see where the program crashes. In most of the cases, it will give you enough info to solve the problem.
|
|
|
|
|
Thanks.I found my probelm.I am using dislog based application. Actually I am using a CImage Class which is derived from CStatic.I have to connect this derived class to a picture control and I have to add a control member variable to the picture control ,This control member variable should have a data type CImage instead of CStatic. I am using VS2005.
S.Yamini
|
|
|
|
|
You derived a CStatic class and on that class use of CImage class,right?
|
|
|
|
|
I have a radio button with ID say, "BTN_RADIO"
I'm trying to control it directly without creating any variables.
Like:
<br />
(CButton*)this->GetDlgItem(BTN_RADIO)<br />
It's fine it works with some thing like ,
<br />
((CButton*)this->GetDlgItem(BTN_RADIO))->ShowWindow(true);<br />
But why the same doesn't work with EnableWindow() ?
For example,
<br />
((CButton*)this->GetDlgItem(BTN_RADIO))->EnableWindow(true);<br />
This doesn't work. Why?
Also , you've got a puzzle here : Clickety[^]
|
|
|
|
|
VuNic wrote: But why the same doesn't work with EnableWindow() ?
It does work.
Probably, you need to give some more information, if at all there is such behaviour.
In short, I could not reproduce it.
Prasad
MS MVP - VC++
|
|
|
|
|
VuNic wrote: This doesn't work. Why?
See here.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
David,
I guess, there should not be any problem with OP's code. I wonder how it could be related to post refered by you ?
Probably, he has missed some thing to tell altogether.
Prasad
MS MVP - VC++
|
|
|
|
|
prasad_som wrote: I wonder how it could be related to post refered by you ?
My post was related as he apparently had a lack of understanding of how GetDlgItem() works.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Just noticing your reply! thanks David, let me have a look at it.
|
|
|
|
|
Hi,
please if you could tell me what type of project I need to use if I want to create process that will run on startup and the whole time computer is turned on.
Process will be monitoring WM message and try to grip user selection. For example catch 'on_mouse_left_button_down,on_mouse_move, on_mouse_left_button_up...
tkx!
P.S. I'm using VC++ 6.0
|
|
|
|
|
Are you looking for some combination of windows services and a hook installed for trapping up all the WM messages?
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|