|
I need read a file and search for certain keywords and extract the string following that keyword.
I have read through the functions CFile::Read, CStdioFile::ReadString, GetPrivateProfileString functions, but they dun exactly meet my requirements.
the closest function is CStdioFile::ReadString, where I have t indicate the number of chars to read from the file. but how can I ensure that I have retreieved the whole line of text in a file, since i do not knwo how long the line is.
Is there other methods/ functions which i can use to extract data from a file?
pls help. thanz in advance
|
|
|
|
|
There are two ways to use the CStdio::ReadString method. The first is to pass a reference to a CString object and the entire string will be read into the referenced object. This is usually the simplest way of doing this. The second method is to allocate a buffer that is larger than the largest string you ever expect to read. You can then use the method that accepts a buffer pointer and a value that represents the size of the buffer. If you do not know what the largest string is you will read, then I suggest you use the first approach.
a).
CString strReadData;
FileToRead.ReadString(strReadData);
b).
char szBuffer[MAX_STRING_EVER_TO_READ+1];
FileToRead.ReadString(szBuffer, MAX_STRING_EVER_TO_READ);
Chris
|
|
|
|
|
In my situation there is one 'server' (Win2000) and there are numerous 'clients' (Win95/98/ME/NT/2000). Both server and clients have modems, but no internet connection.
Now the question is very simple (even though haven't found a simple answer yet): how can I send a file from the server to a client using the modems? I've looked at RAS, TAPI and other complicated stuff , but surely there must be an EASY way to do this.
Structured programming vs. chaotic mind boggling
|
|
|
|
|
you could use the old zmodem transfer protocol (or any of the others) but i don't know where to find a class that does it (sure there must be a CZModem() somewhere...)
---
"every year we invent better idiot proof systems and every year they invent better idiots"
|
|
|
|
|
hi i hve requirements in UK on VC++ with MFC/COM in telecome and embeded systems with 2.5 years exp. and also on GSM. if aou ar ethe on esen dyour cv to naidumg@yahoo.com
Mohan
|
|
|
|
|
hi all!
I have a CFormView, in a split window, and would like to remove the <very> sunken border that is drawn around the edges of the form view by default. Not sure if the border is part of the form or the frame ....
any help very appreciated,
Nick
|
|
|
|
|
Hi Nick - tweak the CREATESTRUCT in the view's overloaded PreCreateWindow...
BOOL CMyFormView::PreCreateWindow(CREATESTRUCT& cs)
{
cs.style = WS_CHILD | WS_VISIBLE;
return CView::PreCreateWindow(cs);
}
|
|
|
|
|
Hi
I am beginner in VC++. I have got a CTreeCtrl in my application from which I want to delete HTREEITEMs upon press of delete key. First I proceed to delete the related data structure for the HTREEITEM selected. Then I proceed to delete the HTREEITEM using the DeleteItem(HTREEITEM) method. If the HTREEITEM to be deleted is a folder with numerous sub items with in it, do i need to delete all sub items individually before deleting the parent HTREEITEM ?
OR could i directly delete the parent HTREEITEM ?
Please help me out on this.
Thank You,
Jayanand.
|
|
|
|
|
Hi
You can handle the TCN_DELETEITEM message that the tree control will send whenever an item is deleted ... this will happen for each child item after you delete a parent item manually.
sorry this answer is a bit brief.
Nick
|
|
|
|
|
Hi
You can handle the TCN_DELETEITEM message that the tree control will send whenever an item is deleted ... this will happen for each child item after you delete a parent item manually. You can delete the data for a child item when this message is sent.
sorry this answer is a bit brief.
Nick
|
|
|
|
|
Hi Nick,
Thank U very much for the reply. Ur mail was brief but informative.
Thanks,
Jayanand.
|
|
|
|
|
How to add a button to title bar ,such as minbutton,maxbutton,thanks!
|
|
|
|
|
You have to process (or handle - don't know English pretty nice ;( ) WM_NCPAINT message...
You have to draw all you custom buttons as reply to this message...
Best regards,
-----------
Igor Soukhov (Brainbench/Tekmetrics ID:50759)
igor_soukhov@mailru.com | ICQ:57404554 | http://siv.da.ru
|
|
|
|
|
What is the easiest way to append a DWORD (the result from GetTickCount in this case) to a BSTR, the following works but I know there must be an easier way:
CComBSTR szString = "";
char szStartTime[11] = "";
sprintf( szStartTime, "%ul", GetTickCount() );
szString.AppendBSTR( szSessionID );
szString.AppendBSTR( szSep );
szString.AppendBSTR( szIPAddress );
szString.AppendBSTR( szSep );
szString.Append( szStartTime );
And the following doesn't work (much to my dismay):
CComBSTR szString = "";
DWORD dwStartTime = GetTickCount();
szString.AppendBSTR( szSessionID );
szString.AppendBSTR( szSep );
szString.AppendBSTR( szIPAddress );
szString.AppendBSTR( szSep );
szString.Append( dwStartTime );
I also tried casting the DWORD as different types but none of this worked. Any suggestions. Thanks.
|
|
|
|
|
Hi !
May be it's the one you'was looking for?
#include <sstream>
using namespace std;
sstringstream ss;
ss << LPCSTR(szSessionID) << LPCSTR(szSep) << LPCSTR(szIPAddress)\
LPCSTR(szSep) << ULONG(::GetTickCount());
CComBSTR szString(ss.str().c_str());
Best regards,
-----------
Igor Soukhov (Brainbench/Tekmetrics ID:50759)
igor_soukhov@mailru.com | ICQ:57404554 | http://siv.da.ru
|
|
|
|
|
Hi
I would like to add a context-sensitive help menu into my current MDI project. Does anyone know how to do this?
Thank you
kk9
|
|
|
|
|
hi,
i want to use an edit control in a idockingwindow in the right pane of the explorer.
the problem: if i press backspace to del the last letter in the edit control, the explorer goes one level up in the directory.
so, how is it possible, to use the backspace (and all the other special keys) for the edit?
thanks
|
|
|
|
|
You need to implement IInputObject and the appropriate methods to get the backspace to work correctly when your docking window has focus. I am in the process of a couple articles that explain this and other things within Explorer bands and toolbars.
If time permits hopefully this week 1 or 2 of the articles will come out.
Cheers,
-Erik
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
My thoughts are my own and reflect on no other.
|
|
|
|
|
|
Hello,
I now C++ pretty well but I'm a MFC beginner. I'm trying to learn it by myself.
How can I change the caption of a button? How can I disable it? I looked into the CButton Class and I can't find how to change it
Anyone can answer this newbie question? (I wish this was as easy as VB) hehe
Thanks
|
|
|
|
|
CButton is derived from CWnd, so you can call methods like
SetWindowText to change the caption or EnableWindow() to enable/disable the window.
Look at all the methods of CWnd which will show you what you can do.
HTH
Jignesh
|
|
|
|
|
Thanks a lot. I must admit that I should have looked at it hehe
|
|
|
|
|
Try this:
GetDlgItem(IDC_YOUR_BUTTON_ID)->EnableWindow(FALSE);
GetDlgItem(IDC_YOUR_BUTTON_ID)->SetWindowText("new text");
F.Dost
|
|
|
|
|
What i do is that in the dialog editor you put the & sign before the letter with the caption.
I hope this is what you need .
SAntiago Suarez
|
|
|
|
|
How can i make my child window scorll when contents are bigger than window size?
What functions do i need to overwrite?
Thanks,
F.Dost
|
|
|
|