?
Solved

CString::Left

Posted on 1998-04-10
2
Medium Priority
?
581 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 5

Accepted Solution

by:
nebeker earned 40 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

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

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

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.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

649 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