Solved

CString::Left

Posted on 1998-04-10
2
493 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
Comment Utility
Just use () instead of []:

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


0
 

Author Comment

by:engllf
Comment Utility
How careless of me.  I should have notice that.
Thanx.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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 seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

743 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now