|
-
Sep 25th, 2002, 02:47 AM
#1
Thread Starter
Member
how to change from "CString" to "long"??
hello..
may i know how to change type from CString to long??
eg., CString------> "123"
to
long --------> 123
is it possible?
pls... help.. sos..
-
Sep 25th, 2002, 03:24 AM
#2
Addicted Member
Use the atol function:
CString str = "123";
long val;
val = atoi(str);
// val = 123
Hope it helps
HD
-
Sep 25th, 2002, 03:45 AM
#3
Thread Starter
Member
thanks..
-
Sep 25th, 2002, 04:38 AM
#4
Hyperactive Member
Originally posted by HairyDave
Use the atol function:
CString str = "123";
long val;
val = atoi(str);
// val = 123
Hope it helps
HD
I don't think atoi() takes a CString object as its parameter.
Hazel can try
int val=atoi((LPCTSTR)str);
Hope it helps.
-
Sep 25th, 2002, 07:58 AM
#5
CString is automatically converted to LPCTSTR so it works without the explicit cast.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Sep 25th, 2002, 09:09 PM
#6
Thread Starter
Member
hey thank you all guyz!
but "atol" doesn't work or there's something wrong wih my program, i cant get the value...
ok..anyway..thanks..
i'll try again..
-
Sep 26th, 2002, 02:44 AM
#7
Thread Starter
Member
hi..
i put some update statements and now my program can work..
thanks for the help..
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|