|
The sizeof keyword gives the amount of storage, in bytes, associated with a variable or a type. Which means that in your case your are getting the size of str which is nothing but a pointer. A pointer stores a memory location, which is only 4 bytes. If you truly want to get the size in bytes of your string that you should try this:
size = sizeof(char) * strlen(str)
// Afterall, I realized that even my comment lines have bugs
|
|
|
|
|
Hi,
We create a Trial.txt & a Trial.mdb (using FTP to transfer) and put them on our Web-Page (\database\...). We are able to use VC++ 6.0 to link to our Web Page & read the Trial.txt by the following codes:
<br />
pConnect = pInetSession->GetFtpConnection (strServerName, "xxxxxxxx", "pppppppp", nPort, FALSE);<br />
<br />
pFile = pConnect->OpenFile ("Database/Trial.txt",.......);<br />
<br />
pFile->Read (str, 100 ,...)<br />
*) The problem is: I do not know what command to open the Trial.mdb ... does anyone show me how to do it?
Many thanks
Anh
|
|
|
|
|
Hello again!
How can each button have its own width like on the IE toolbar? I added some text to my buttons and they all take their width from the widest button...
Thanks!
---------------
Tired of Spam? InboxShield 2.0 is now available for Microsoft® Outlook® 2K/2K2/2K3
http://www.inboxshield.com
|
|
|
|
|
Use the BTNS_AUTOSIZE style - when a button has that style, it resizes itself to be just wide enough for the icon+text.
--Mike--
"So where does that leave us? Well, it leaves us right back where we started, only more confused than before." -- Matt Gullett
Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber
|
|
|
|
|
This what I have :
if(!m_wndToolBar.CreateEx(this,
TBSTYLE_FLAT | TBSTYLE_LIST | TBSTYLE_AUTOSIZE,
WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_TOOLTIPS )
|| !m_wndToolBar.LoadToolBar(IDR_MAINTOOLBAR))
{
TRACE0("Failed to Create Dialog Toolbar\n");
EndDialog(IDCANCEL);
}
TBSTYLE_AUTOSIZE is the same as BTNS_AUTOSIZE.
The buttons still have the same width Why?
---------------
Tired of Spam? InboxShield 2.0 is now available for Microsoft® Outlook® 2K/2K2/2K3
http://www.inboxshield.com
|
|
|
|
|
|
My program uses SHFileOperation to copy, move, rename, and delete hundreds of files. For most people, doing those steps to ~400 files takes under 15 seconds, but for some people it takes a LOT longer:
<br />
-----------------------------------------------------------------<br />
Timings at 08:11:20 Thursday, June 19, 2003<br />
-----------------------------------------------------------------<br />
CModScript::Activate took 688.45 seconds (called 2 times)<br />
SHRenameFile took 225.50 seconds (called 225 times)<br />
SHCopyFile took 461.89 seconds (called 461 times)<br />
SHCopyFile_SHFileOperation took 461.78 seconds (called 461 times)<br />
SHMoveFile took 2.00 seconds (called 2 times)<br />
Notice a pattern? Each operation takes EXACTLY 1.0 second! Another user having that problem had the exact same results, too, with SHDeleteFile also taking exactly 1.0 second per call. It isn't the users' computers' fault, either; they have similar specs to those having fast, normal times.
What could the problem be? This is a very confusing and unusual The only thing I can think of to fix the problem is to try using the Win32 CopyFile function, but that'd just avoid the problem and not solve it.
|
|
|
|
|
Like topic says, I'm looking for some tips to do this, like you can see in IE for it's toolbar buttons...
Thanks!
---------------
Tired of Spam? InboxShield 2.0 is now available for Microsoft® Outlook® 2K/2K2/2K3
http://www.inboxshield.com
|
|
|
|
|
You can have text beside the icons if you use the TBSTYLE_FLAT|TBSTYLE_LIST style flags
--Mike--
"So where does that leave us? Well, it leaves us right back where we started, only more confused than before." -- Matt Gullett
Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber
|
|
|
|
|
That was easy... I was using Create instead of CreateEx so that's why I wasn't able to do it!
Thanks!
---------------
Tired of Spam? InboxShield 2.0 is now available for Microsoft® Outlook® 2K/2K2/2K3
http://www.inboxshield.com
|
|
|
|
|
hello
i want to link my application with one kind of file (*.dsw or *.cpp).
i want when i click on the files that i have tell above my application run.
|
|
|
|
|
|
Why doesn't this do what I want:
cout << L"Hello world";
This prints out the address of the string, because it interprets it as a void*. Is there not an overload for WCHAR*?
|
|
|
|
|
Try
wcout << L"Hello world";
|
|
|
|
|
Aaaaahhhhhh... there's a wcout! It's funny, because the AppWizard (at least in VC6) generates this for a default console app:
cerr << _T("Fatal Error: MFC initialization failed") << endl;
which if compiled with UNICODE, would print out the address of the string.
I guess I'll have to do something like
<br />
#ifdef UNICODE<br />
#define _tcout wcout<br />
#else<br />
#define _tcout cout<br />
#endif<br />
in order to have some kind of "tchar-ish" macro, 'cause I can't find one already defined.
|
|
|
|
|
The tcout thing is exactly what I did, and it works like a charm.
"When a man sits with a pretty girl for an hour, it seems like a minute. But let him sit on a hot stove for a minute and it's longer than any hour. That's relativity." - Albert Einstein
|
|
|
|
|
I need help ASAP.
I have one document with two views (splitter) , left view(CView),right view(CScrollView).
This is my code:
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
CRect cr;
BOOL rc;
if (!m_wndSplitter.CreateStatic(this,1,2))
{
TRACE0("Failed to create split bar ");
return FALSE; // failed to create
}
GetClientRect(&cr);
CSize paneSize(cr.Width()-200, cr.Height());
CSize paneSize1(0, cr.Height());
((CMyApp*)AfxGetApp())->m_pDoc=(CMyDoc*)(pContext->m_pCurrentDoc);
pContext->m_pCurrentFrame=this;
rc=m_wndSplitter.CreateView(0, 1,pContext->m_pNewViewClass,paneSize, pContext);
if(!rc)return FALSE;
pContext->m_pNewViewClass=RUNTIME_CLASS(CSnapShotView);
pContext->m_pCurrentDoc=((CMyApp*)AfxGetApp())->m_pDoc;
pContext->m_pCurrentFrame=this;
rc=m_wndSplitter.CreateView(0,0,pContext->m_pNewViewClass,paneSize1,pContext);
m_wndSplitter.SetSplitterGapSize(1);
m_wndSplitter.RecalcLayout();
m_wndSplitter.SetActivePane(0,1);
return rc;
}
I don't know why ,but after i added splitter my right view(CScroll view) doesn't support MouseWheel .
Plese help me !!!!!!!!!!!!!!!!!!!!!
|
|
|
|
|
Nobody knows ,or it's to simple??
|
|
|
|
|
Hiya I have now to extract all of the records from a buffer. The code I have works for the first record and then crashes..I have to extract from the buffer the 12 up to and including the carriage return.
So I would extract "12,grahamoj,34,this,\r" as the first record and so on.
This is my code:
char buffer[] = "this,is,not,needed,12,grahamoj,34,this,\ris,not,need"
"edeither,12,tony,34,this,\ris,not,needed,either,this"
"is,not,needed,12,paul,34,this,\ris,not,needed,either";
char *pStart;
char* pEnd;
char* pTemp;
pTemp = new char[100];
// search for carriage return
pEnd = buffer;
do
{
pStart = strstr(pEnd,"12,");
if( pStart )
{
pEnd = strstr( pStart,"34,");
if( pEnd )
{
pTemp = strtok( pEnd,"\r" );
}
}
strcpy( buffer,pStart );
AfxMessageBox( buffer );
}while( pTemp != NULL );
As I say it extracts the first record perfect and then crashes..
Can anyone fix this or is there a better way to extract multiple records??
Thanks.
|
|
|
|
|
This is not a problem. You have the solution, just debug it until you get it right instead of asking for help.
Kuphryn
|
|
|
|
|
Another solution to your problem is to replace all the carriage returns with nulls, then process the buffer as an array of zstrings.
*(cpBuffer + strlen(cpBuffer) + 1) = 0;
char *p = strchr(cpTheBuffer,'\r');
while (p && *p)
{
*p = 0;
p = strchr(p+1,'\r');
}
p = cpTheBuffer;
while (*p)
{
ProcessRecord(p);
p += strlen(p)+1;
}
onwards and upwards...
|
|
|
|
|
Thanks basementman, good suggestion but have to actually extract the strings and display them individually.
Any other ideas??
thanks.
|
|
|
|
|
In the ProcessRecord function described previously, you can do the same sort of logic with the comma field delimiters just as you have done with the record delimiters. As a matter of fact, you could use the same function (genericized, of course) to parse records and fields simply by parameterizing the delimiter character. You could also make it more robust by respecting the delimiters that appear in quoted strings, etc.
onwards and upwards...
|
|
|
|
|
what does 0x0a mean in this context?
if (symbol == 0x0a)
count++;
Mark J Jackson
|
|
|
|
|
|