Solved

CString::Left

Posted on 1998-04-10
2
505 Views
Last Modified: 2013-11-20
How do i solve this problem?
I need to extract the leftmost 5 characters of a CString.

CString szSvPath("D:\\AB\\CDE\\F.EXE") ;
CString szPath ;
szPath = szSvPath.Left[5] ;

error C2109: subscript requires array or pointer type
error C2679: binary '=' : no operator defined which takes a right-hand operand of type 'class CString (CString::*)(int)const ' (or there is no acceptable conversion)
Error executing cl.exe.
Creating browse info file...

0
Comment
Question by:engllf
2 Comments
 
LVL 5

Accepted Solution

by:
nebeker earned 20 total points
ID: 1317601
Just use () instead of []:

CString szSvPath("D:\\AB\\CDE\\F.EXE") ;
CString szPath ;
szPath = szSvPath.Left(5) ;


0
 

Author Comment

by:engllf
ID: 1317602
How careless of me.  I should have notice that.
Thanx.
0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Unix / Linux grid computing 5 157
not able to insert into temp table 68 162
noX challenge 17 116
Problem to event 3 96
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question