• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 339
  • Last Modified:

How to change CString to a 64 bit integer

Hi Experts,

How can I change a CString to 64 bit integer?  
0
thanesh
Asked:
thanesh
  • 3
1 Solution
 
rajeev_devinCommented:
CString str("2342353465664");

_atoi64(str.GetBuffer());
0
 
rajeev_devinCommented:
Error free code.
CString str("2342546546754756786678");
__int64 data = _atoi64((LPCTSTR)str);
0
 
thaneshAuthor Commented:
Hi Rajeev,

Thanks. Why would the first one be error prone?
0
 
rajeev_devinCommented:
Two reasons

1. GetBuffer(int nMinBufLength );  takes one parameter.

2. You need to store the converted value somewhere :)
__int64 data =
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now