|
Hi!
Need some help with a converting problem.
I will have my time in a buffer, but it complain on the converting. See code :
int main(){
char hour,minute, second;
int hh, mm, ss;
char buffer[10];
time_t times;
tm * ptm;
time ( × );
ptm = gmtime (×);
hh = ptm->tm_hour;
mm = ptm->tm_min;
ss = ptm->tm_sec;
hour = itoa(hh);
minute = itoa(mm);
second = itoa(ss);
strcpy(buffer, hour);
strcat(buffer, ":");
strcat(buffer, minute);
...
return 0;
}
the message that occur when I compile is
ctid.cpp: In function `int main()':
ctid.cpp:44: error: invalid conversion from `char*' to `char'
ctid.cpp:45: error: invalid conversion from `char*' to `char'
ctid.cpp:46: error: invalid conversion from `char*' to `char'
Thankful for your help
|
|
|
|
|
there is not x. it is ×
|
|
|
|
|
You gave all the lineno where the error is , but you forgot to number the line in ur code.
The World is getting smaller and so are the people.
|
|
|
|
|
|
Does any one know how to use the Mci32.ocx component or direct me to the documentation of the same.
regards,
Prakash.
The World is getting smaller and so are the people.
|
|
|
|
|
hello
i want to get the user info that is the information of domain name workstation and the user using the netbios api and NCB structure and name buffer structure please tell me how to use these structure in Netbios command can u give me the example
|
|
|
|
|
MSDN is full of examples. The one I am familar with is article Q118623. You can also Google the Net for tons more.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Hi!
I didn't know why did i get so many errors at compiling the source code.
I figured out that the problem is that i don't have the shell32.dll version 5.
I searched for it on the Net, but i didn't find it. From where to get it?
Thanks for your answer!
|
|
|
|
|
|
OK, but there are a lot of sdk files?
Which package do i need to download?
Thanks!
|
|
|
|
|
I have the following function
void CViewDBDlg::OnErrorAdodc1(long ErrorNumber, BSTR FAR* Description, long Scode, LPCTSTR
Source, LPCTSTR HelpFile, long HelpContext, BOOL FAR* fCancelDisplay)
{
// TODO: Add your control notification handler code here
}
I am not able to / I do not know the correct procedure to get the Description text from BSTR FAR*
Description. Please guys I need help on this immediately.
Nalini
|
|
|
|
|
use _bstr_t to deal with BSTR's
_bstr_t bstr(*Description);
now you can use the (LPCTSTR) operator on it to get a null terminated string.
CString str( (LPCTSTR) bstr );
|
|
|
|
|
Thanks a lot Paul. It works. Really apprecaite the help.
Nalini
|
|
|
|
|
How do I convert a non-wide string to wide format?
|
|
|
|
|
There are several macros for doing string conversion. In VC7 you would use CA2W(), in VC6 it is A2W()
lookup those macros in msdn and it will explain all.
|
|
|
|
|
I have been messing around with these with no luck...eg. mbstowcs and I get nothing...with T2W I get the following errors:
error C2065: '_lpa' : undeclared identifier
error C2440: '=' : cannot convert from 'char *' to 'int'
error C2065: '_convert' : undeclared identifier
what I am trying to convert is TCHAR* passed through a function to a WCHAR local variable in the function but nothing seems to work.
|
|
|
|
|
TCHAR * psz;
WCHAR * pwsz;
USES_CONVERSION; // if you are using VC++6 you need this
pwsz = T2W(psz);
|
|
|
|
|
Slight warning here: ATL 3.1 (shipped with VC 6.0) uses _alloc to allocate memory. For a large string, you can get stack overflows.
ATL 7.0 uses the heap to allocate memory for the new string.
In the general case, use mbstowcs or MultiByteToWideChar .
|
|
|
|
|
MultiByteToWideChar function will convert Char string WCHAR string and WideChartoMultiByte function does the opposite way.
|
|
|
|
|
|
|
I would like to know about hooking modal windows. Currently I am using SetWindowHookEx which could hook all toplevel windows and I could hook modal dialogs by using WH_CALLWNDPROC and WM_INITDIALOG but I could not hook other modal windows.
Expecting earliest solution.
Thanks and Regards
S.L.Rao
|
|
|
|
|
I'm the person who started the string below called "where's main() ???".
Ravi was helping me but either has given up on me or gone to bed
So, here's my question: If I create a dialog window and want to run
graphics in it continuously, where do I put my code that does the
graphics? I'm not using messages, the application is free-running.
I would guess I'm not the first person to ever wonder "Gee, I wonder
where my application goes?" but none of my 4 books tell me and no
one else has been able to tell me. Having just finished my C++ class,
this is my first and foremost question -- where does the code go now
that I'm no longer running console-only apps?
I've spent all day trying to figure this out, including numerous and
fruitless web searches. I presume the place where the application
code goes is well-defined and well-known, can someone tell me?
Thanks.
Dave
|
|
|
|
|
Well mate, i had a similar problem when i moved from dos based programing to windows type programming....
In windows you have created a dialog app, so you do need to responde to messages to get you job done effectivly, else i can only say that your code will become very inefficient.
You cant have a continouse loop waiting for the keypress by the user to terminate the application....like we did in dos programs.
the loop is there but it is called as the message loop. you can add your code in the message pump loop, but still again its inefficient.
You can setup a timer and respond to the timer every now n then. or you can handle the OnIdle event to do things that you would like to do. but you should not lock up that event,i.e return back as soon as possible.
Summury:You need to change the design of your application when making a moveing to windows.
hope i helped you someway.
regards
Prakash.
The World is getting smaller and so are the people.
|
|
|
|
|
Prakash,
Thank you very much for your suggestions. Sorry it took
so long to get back to you but I had to do some quick
reading of timers and the OnIdle event. I think one
of these will work for me and I appreciate your help.
I'm willing to change the design of my application, I
just didn't understand the need to until your reply.
Thanks again!
Dave
|
|
|
|