|
From memory I think you can do getline(infile, mystring, "\n") or something.
Kevin
|
|
|
|
|
I don't want it to stop on 'newline'. I want it to read a fixed number of bytes.
|
|
|
|
|
I couldn't find that getline with no. of bytes that Ray mentioned. I suppose you could use the getline that gets the whole line and then use a substring function. Not as elegant but still avoids char*.
Kevin
|
|
|
|
|
LiquidEyes wrote:
However I don't see how it will know to stop after (say) 20 characters?
It doesn't. You'll have to use the read() method of ifstream to do that.
LiquidEyes wrote:
Without a delimeter, will it read the whole file into the string?
No, as I said, the default delimiter is a newline - it will read a single line.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
You'll have to use the read() method of ifstream to do that.
Precisely. Which takes us back to my original question ... what structure can I read into instead of an old fashioned char* array?
I just thought there might be an elegant way, using vector s or string s or something, that didn't involve allocating char s manually. As I said, maybe I just want the moon on a stick.
|
|
|
|
|
LiquidEyes wrote:
what structure can I read into instead of an old fashioned char* array?
Just quickly looking at the docs, it appears you can use ifstream::getline(mystring, number_of_chars) . If you pass a size of, say, 10, it reads 9 characters and appends a NULL. Once again, you can add a third parameter which is the delimiter if you need it.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Hi all,
I'm running myProg.exe and while it is still process, I killed the process by either going to task manager or right click and close. Then sometime, when I rebuild it again, it failed to rebuild.
<br />
myProg Command line warning D4028 : minimal rebuild failure, reverting to normal build<br />
C:\myProg\myProg\myProg.cpp fatal error C1033: cannot open program database 'c:\myProg\myProg\deug\vc70.idb'<br />
C:\myProg\myProg\myProg.cpp fatal error C1033: cannot open program database 'c:\myProg\myProg\deug\myProg.pdb'<br />
<br />
I have to either delete the myProg.pdb manually or if I can't (sometime get the error message saying, myProg.pdb is still in used), I have to restart the computer in order to rebuild the project..
Is anyone of you have the same experience that I'm facing.. please tell me what is wrong with it?
Thank you.
|
|
|
|
|
pnpfriend wrote:
I killed the process by either going to task manager...sometime get the error message saying, myProg.pdb is still in used...
Are you killing the myprog.exe or msdev.exe process?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
|
If I create a window in another window in the non-client area then send the WM_PAINT message to the child window if the parent receives a WM_NCPAINT message, the client window doesn't redraw (the non-client area it is on is still garbled with the old pixels that were in those rect). How can I solve this?
|
|
|
|
|
hello
i want to make ActiveX control (VC++6.0) build from other ActiveX controls created in run time. i used MFC ActiveX Wizard to generate the code and now:
1) i have AfxEnableControlContainer() in InitInstance
2) in OnDraw i'm trying to do sth. like:
this->CreateControl("QButton.Button", "", WS_VISIBLE, rc, this, IDR_BATON, NULL, FALSE, NULL);
but it causes run time error (assertion failed with hwnd argument).
can anybody help me?
thanks in advance
--
s3b0
|
|
|
|
|
i have two vectors i am trying to compare the first is a string vector and the other is a char vector. i am trying to find for example the word hello in the grid vector and i can find the fist char but i dont know how to move or set up a loop to check all the possible directions for the next char in the string. here is a bit of my code. Once the first char is found i need to find the next which the next char could be in 9 possible directions.
-String Vector-
01234
0hello 1apple
2car
3me 4men
5ran
6woman
-Grid Vector-
01234
0cenad
1aatps
2rnrpj
3hello
4wmneo
/*------------------- A Word Checker ----------------------*/
for(int i=0; i < GridVector.size(); i++)
{
for(int j=0; j < GridVector.size(); j++)
{
if(StringVector[0][0] == GridVector[i][j])
{
{
}
}
|
|
|
|
|
Does anyone have a spell checker that they recommend for integration into Windows apps? We are looking for a quality once, it does NOT have to be free. It should be able to be integrated with several different technologies, including Borland C++, Delphi, and Microsoft C++ and .NET (so I presume that an API with a COM interface is the best way to go).
Thanks for any suggestions,
~Steve
|
|
|
|
|
Oops, forgot something... it would be a great benefit if the dictionary was available with medical terms already in it.
~Steve
|
|
|
|
|
There is one (International CorrectSpell) offered by Lernout & Hauspie Speech Products.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
David, thanks for the suggestion... I'll look into that one.
~Steve
|
|
|
|
|
DavidCrow wrote:
Lernout & Hauspie Speech Products.
That company went belly up long time ago.
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
|
|
|
|
|
Nemanja Trifunovic wrote:
That company went belly up long time ago.
Be that as it may (I can neither confirm nor deny), the product, at least the 1993 version, is still licensed to them and is still in use by Microsoft Office XP.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
|
Thanks for the links, especially the componentsource one... that look like one that I'll have to keep on file for future projects.
~Steve
|
|
|
|
|
I handle the right click in a CTreeCtrl with
ON_NOTIFY( NM_RCLICK, IDC_TREE1, OnTreeRclick )
and
void CTestTreeDlg::OnTreeRclick( NMHDR* pNMHDR, LRESULT* pResult )
{
NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
HTREEITEM hSelItem = pNMTreeView->itemNew.hItem;
}
When I right click on the tree background, not on a leaf or node, the hSelItem is not valid, and is not a "simple" value like NULL or zero.
Is there a way to check to see if the HTREEITEM item is valid ?
I tried the following to see if I can get the item based on the hitem the notification message gave back, it could "work" but it gives a "First-chance exception" when passing a bad hitem.
TVITEM item;
TCHAR szText[1024];
item.hItem = hSelItem;
item.mask = TVIF_TEXT | TVIF_HANDLE;
item.pszText = szText;
item.cchTextMax = 1024;
BOOL bWorked = m_Tree->GetItem(&item);
Thanks.
Max.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
I would use:
void CTestTreeDlg::OnTreeRclick( NMHDR* pNMHDR, LRESULT* pResult )
{
CPoint point(GetMessagePos());
m_tree.ScreenToClient(&point);
<br>
HTREEITEM hi=m_tree.HitTest(point);
<br>
if (hi)
{
}
} where m_tree is the CTreeCtrl member associated with your control.
Maybe not the best method but it works.
"though nothing
will keep us together
we can beat them
for ever and ever"
rechi
|
|
|
|
|
yep, I've read about using HitTest .
It seems like the lesser evil ...
Thanks.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
How to find a template in a Bmp file? Maybe the template in the Bmp file is rotate or scaled.Who can tell me the algorithm? Thanks!
|
|
|
|
|
I made a MFC ActiveX. I want to open the activeX in a toolWindow with the createToolWindow method.
When The toolWindows is created, I have Hatched border at the right and bottom of my activeX.
How can i do to suppress it ? (It seems that all MFC ActiveX i downloaded do the same thing....)
|
|
|
|