|
|
Where is it documented that SHFileOperation() uses GetLastError() ?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
It isn't. I incorrectly assumed SHFileOperation() called SetLastError() .
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
SHFileOperation already informs the user of any error, unless you use the FOF_NOERRORUI flag in your request.
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
Is there any documentation on what error messages SHFileOperation uses? I've tested the function a few times without the FOF_NOERRORUI flag, and it can sometimes return unsuccessful without displaying any error message.
|
|
|
|
|
|
hi i am new to c++ and i would like to know how i can put date into a varieble called a
and time into a varieble called b like(DDMMYY) and (2400)
^^ me noob
|
|
|
|
|
Something like:
int a = 290605;
int b = 0929;
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
i mean how to let the program automaticly store todays date and the current time into the varieble when the that line of code is being runed
|
|
|
|
|
See CTime() - specifically CTime::GetCurrentTime() .
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Check out the time() function.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
so do i put it this way?
#include <iostream>
using namespace std;
int time;
int main (void)
{
time = CTime();
return 0;
}
but i tryed tis and i dosnt work pls giv me an example pls
|
|
|
|
|
nneodeath wrote:
so do i put it this way?
What does the compiler say?
nneodeath wrote:
time = CTime();
CTime is an MFC class. To instantiate one, use:
CTime time; To construct one with the current date and time, use
CTime time = CTime::GetCurrentTime();
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
i tryed it but i doesnt really work could u please show me what i am doing wrong
#include <iostream>
using namespace std;
CTime time;
int main (void)
{
CTime time = CTime::GetCurrentTime();
cout << time << endl;
return 0;
}
this is my code pls help me correct it so that the date and time goes like this
time variebles
HHMM <==this order
date variebles
DDMMYY<==this order
|
|
|
|
|
nneodeath wrote:
cout << time << endl;
Use:
cout << time.Format("%x") << endl;
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
#include<iostream>
using namespace std;
CTime time;
int main (void)
{
CTime time = CTime::GetCurrentTime();
//cout << time << endl;
cout << time.Format(time) << endl;
return 0;
}
the outcome:
--------------------Configuration: tiemsam - Win32 Debug--------------------
Compiling...
tiemsam.cpp
C:\Documents and Settings\nick\Desktop\currently doing cpp project\tiemsam.cpp(4) : error C2146: syntax error : missing ';' before identifier 'time'
C:\Documents and Settings\nick\Desktop\currently doing cpp project\tiemsam.cpp(4) : error C2501: 'CTime' : missing storage-class or type specifiers
C:\Documents and Settings\nick\Desktop\currently doing cpp project\tiemsam.cpp(4) : fatal error C1004: unexpected end of file found
Error executing cl.exe.
tiemsam.exe - 3 error(s), 0 warning(s)
please help me see wats the problem
|
|
|
|
|
Why do you have two CTime variables?
nneodeath wrote:
cout << time.Format(time) << endl;
This is wrong. See my previous post.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
|
Flace wrote:
With _MBCS defined, size of TCHAR is 1 byte, so you cant even multiply _tcslen with this
I'm confused by this statement. But the number of occupied bytes in your string will be :
<br />
int nBytes = (_tcslen(pszString) * sizeof(TCHAR));<br />
The sizeof() will return the number of bytes occupied per character. This will obviously vary depending if you are working in single byte or double byte character mode.
I Dream of Absolute Zero
|
|
|
|
|
If you know you have a multibyte string, you can simply use strlen() to obtain the number of bytes.
void SomeFunction(LPSTR pString)
{
int nChars = _mbslen(pString);
int nBytes = strlen(pString);
[...]
}
If you are using the TCHAR macros you can do it like this:
void SomFunction(LPTSTR pString)
{
int nChars = _tcsclen(pString);
int nBytes = _tcslen(pString) * sizeof(TCHAR);
}
Note _tcslen is different than _tcsclen .
If _UNICODE is not defined, _tcslen resolves to strlen , and sizeof(TCHAR)==1 .
If _UNICODE is defined, _tcslen resolves to wcslen , and sizeof(TCHAR)==2 .
So, _tcslen(pString) * sizeof(TCHAR) will give you the number of bytes in any case.
Hope that helps,
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
Jose Lamas Rios wrote:
If you know you have a multibyte string, you can simply use strlen() to obtain the number of bytes.
can you not have a NULL in the middle of a multi-byte string?
Jose Lamas Rios wrote:
If _UNICODE is not defined, _tcslen resolves to strlen, and sizeof(TCHAR)==1.
If _UNICODE is defined, _tcslen resolves to wcslen, and sizeof(TCHAR)==2.
So, _tcslen(pString) * sizeof(TCHAR) will give you the number of bytes in any case.
If _UNICODE is not defined, and _MBCS is defined, _tcslen resolves to _mbslen. And you know, _MBCS is defined by default in the project settings. So, _tcslen(pString) * sizeof(TCHAR) will not always give you the number of bytes all the time...
|
|
|
|
|
|
Two above posts are correct, except only the one thing. As MSDN says :
"these functions returns the number of characters in string, excluding the terminal NULL."
So, I suppose, the correct answer on the question will be
(_tcslen(str) + 1) * sizeof(TCHAR)
Andrew
|
|
|
|
|
|
Hi all,
Can I make a variable argrument function like foofunc(char*, const char *,...); as a virtual function in C++ class.?.
Thanks in Advance
Abhi Lahare
|
|
|
|