CString problem?

hello,

CString str;
str="hello wolrd";

how can i get first 4 letter of str?

is there any function to get it?

sorry i am new in visual c++ field,

thanks

0
halmuratov (38)
2/8/2007 6:13:57 PM
vc.mfc 33608 articles. 0 followers. Follow

3 Replies
451 Views

Similar Articles

[PageSpeed] 10

halmuratov@gmail.com wrote:
> hello,
> 
> CString str;
> str="hello wolrd";
> 
> how can i get first 4 letter of str?
> 
> is there any function to get it?
> 
> sorry i am new in visual c++ field,

halmuratov:

CString::Left();

You should be able to find this in the Help. If you know the name of the 
class, just look at the members (for CString in VS2002 and up you 
actually have to look at the members of CStringT).

David Wilkinson
0
no-reply8010 (1790)
2/8/2007 6:27:37 PM
On Feb 8, 1:13 pm, halmura...@gmail.com wrote:
> hello,
>
> CString str;
> str="hello wolrd";
>
> how can i get first 4 letter of str?
>
> is there any function to get it?
>
> sorry i am new in visual c++ field,
>
> thanks

	CString str, T;
	str = "Hello World";
	T = str.Left( 4 );
	// T = "Hell";

0
2/8/2007 6:28:07 PM
On Feb 8, 7:28 pm, "vernoneda...@gmail.com" <vernoneda...@gmail.com>
wrote:
> On Feb 8, 1:13 pm, halmura...@gmail.com wrote:
>
> > hello,
>
> > CString str;
> > str="hello wolrd";
>
> > how can i get first 4 letter of str?
>
> > is there any function to get it?
>
> > sorry i am new in visual c++ field,
>
> > thanks
>
>         CString str, T;
>         str = "Hello World";
>         T = str.Left( 4 );
>         // T = "Hell";

thanks alot, it worked!!!

0
halmuratov (38)
2/8/2007 6:34:07 PM
Reply:

Similar Artilces:

A Problem with Office 2003
There is a conflict between Word and Outlook that really "bugs" me. If Outlook is running Word will not run correctly. I hate having to shut down Outlook in order to use Word. For what it is worth, I can make the window smaller [minimize] but when Word is as big as it can get, there is space between the top edge of the window and the top of the display and the bottom of the window is out of sight at the bottom of the display. If you click & hold on the blue band on the top of the window, you cannot drag it up, down, or sideways; it is as if it is frozen. The only way to be...

complex problem
Hi all, I have four variables each with it's own column of data, all the same length. Each row will give me a new calculated value, say C5 = C1+C2+C3+C4 for example. Then I want to do a correllation function in C6 that compares C5 to data I already have and store that correllation number in an array. Then shift C1 down a row, recalculate C5, recalculate C6, store new correlation number Then shift C1 down another row, recalc, store Shift C1 down three times, then start shifting C2 down three times, then C3, then C4. I would love for this to happen in arrays becaus...

sending CString to CStatic label control from worker thread
I need to send a CString from a thread to a static label on the main dialog form. I think I have the thread working okay, but I am unsure how to send the CString to the dialog control. I have seen information on using PostMessage and SendMessage, but I don't really understand how to use these functions. Obviously I can't do like I tried below and I can't get a pointer to the control from the thread function, so just how do I say send the word "hello" to the SetWindowText() function of the label control on the dialog form. I have looked on the Internet and in se...

Public Folder Problem #2
Had three Exchange servers, 1, 2 and 3. All 5.5 with most recent SP running on Win 2K. 1 was and still is the primary 2 went away and was in it's own site (site connector to 1) 3 is a new and in the same site as 1 Followed the white paper on moving an Exchange server from one site to another. Moved all the public folders from 2 to 1 and removed the replicators. I feel like I should be providing more info here but that was pretty much all there was to it. Everyone with proper permissions can see all the Public Folders, including the ones from the old site that had been moved. However, i...

Problem with refreshing animated bitmap
Hello, I've got quite a problem with which I've been strugling whole day and can't pass through it. I've got a problem with OnPaint which doesn't work as it should be ( after trying countless samples from @groups, and various sites. Here's the code: void My_CMainWnd::OnPaint () { CPaintDC dc(this); dcMem->CreateCompatibleDC(&dc); CBitmap *pOldBitmap = new CBitmap; pOldBitmap = dcMem->SelectObject(myEng->TloBitmap); CRect rcClient; GetClientRect(&rcClient); myEng->BBitmap->DrawTransparent(dcMem,myEng->Balls->BCoordinates- >x,myEng...

CString
How can I covert argv[0] to LPCSTR? Hi, Shouldn't CString(argv[0]) do the trick? Sander Verhagen [ Verhagen@nonono.Sander.com ] "Oliver Young" <please@no.spam.com> wrote in message news:er3JuEogDHA.616@TK2MSFTNGP11.phx.gbl... > > How can I covert argv[0] to LPCSTR? > > > Shouldn't CString(argv[0]) do the trick? OK. And how can I convert CString into LPCSTR? I need LPCSTR. I need to convert from char** ( argv[0] ) into LPCSTR. Please, forget CString, and MFC if possible. > How can I covert argv[0] to LPCSTR? LPCSTR...

Money Budget and Mortgage problems HELP!
I set up a budget with my mortgage payment. The problem is, th mortgage payment is acutally showing up on Special when I view th budget and I can't budget anything under special. How do I get th budget to recognize my mortgage so that I don't have to line items i budget one with zero target (special debt) and one with zero expense (debt loan) I am having the same problem. If you or anyone else figures out the answer, please let me know at chelly(remove this)@gci.net. THANK YOU! "marzomarz" wrote: > I set up a budget with my mortgage payment. The problem is, the &...

Access 2003 Form Wizard and Toggle Button Confusion/Problems
I am trying to use the Access 2003 Form Wizard to create a subform that will response to a toggle button that I created and to display that subform within my main form. However, I do not get the wizard window that is suppose to allow me to indicate that I want this to be a linked form so that it will appear within my main form (I see this example in a book that I have). Nor can I figure out how to manually create a link to that subform so that it is associated to the toggle buttion that I created so that it will appear within my main form. (I figured out how to write simple code so ...

Macbook Trackpad right click problem
Apple & Microsoft claim that they do not have the correct driver for MacBook Trackpad to run the full function eg. single click, double click on trackpad & right click function. Please anyone have any suggestions on third party driver is welcome. Thank you. I'm not sure what this has to do with CRM... but: The track pad functionality should all work If you have installed Apples BootCamp drivers. The drivers provided enable all the various hardware - trackpad, bluetooth and wireless, IR, volume and brightness controls etc. The drivers used to be downloadable from Apples sit...

Cd Burning Problems
I am trying to burn a few songs to an Audio CD-R in Windows Media, I have added them to the burn list, however the start burn button at the bottom of the pane does not light up for me to click it to actually start the burn.... Am i missing a step? This worked for me in the past and now i am ver confused? "betty" wrote: > I am trying to burn a few songs to an Audio CD-R in Windows Media, I have > added them to the burn list, however the start burn button at the bottom of > the pane does not light up for me to click it to actually start the burn.... &...

Problems, Problems
I recently installed Windows XP upgrade on my home computer. According to the instructions, all programs would be saved on the computer and work in Windows XP. This held true for my internet connections, favorites, documents etc, but I'm having problems with my email. Under my account name, I had to redo my internet settings, and while I can receive and send email now, I cannot access any of my old contacts, or emails saved in my inbox or other files! To make matters worse, when I try to open Outlook express under my hubby's account (the systems adminstrator on the compute...

Uninstall Sales for Outlook problem
I had to reinstall the server program because CRM trashed it. Now I have it up and running again but I can't install the Sales for Outlook because there is already an install there. When I try to uninstall it (in add/remove programs) it says that this action is only valid for products that are currently installed. How do I manually uninstall Microsoft CRM Sales for Outlook? I am trying so hard to use this program to see if it will be a benefit to customers but after 4 months on and off of trying to get it working, a am not sure I see the point. -- )))))))))))))))))))))))))))))))))...

Percentage problem
Hello, A record can belong to one of three groups and each record has a value attached to it. How can I calculate the total for each group as a percentage of the overall total? like 1 £33 33% 2 £33 33% 3 £33 33% ...

Fix for EXCHANGE to hotmail sending problem bdat
TURN OFF THE AUTO PROTECT FEATURE FOR INTERNET EMAIL IN THE SYMANTEC DESKTOP CLIENT THAT YOU INSTALLED ON YOUR EXCHANGE SERVER. IT MESSES UP BDAT ARGGGG!!!!!!! SOMETIMES I'M SUCH AN IDIOT!!! ...

class problem
He, I wrote the following code under //attributes: protected: BOOL m_bAdding; m_bAdding = FALSE; when I'm compiling it. It give me this error: C:\Documents and Settings\wouter\Mijn documenten\Rocket Administration\Rocket AdministrationView.h(32) : error C2501: 'm_bAdding' : missing storage-class or type specifiers Rocket AdministrationView.cpp C:\Documents and Settings\wouter\Mijn documenten\Rocket Administration\Rocket AdministrationView.h(32) : error C2501: 'm_bAdding' : missing storage-class or type specifiers Can someone help me out? Wouter do not initia...

Chart problem with dates
Hi, I am creating a chart that has week day information only, but when the chart is formed, the weekends are included. Is there a way to exclude the weekends? There is no weekend information in the chart data area. Thank you, Janel Hi, In order to exclude dates that do not have data you can set the axis to be categorical. This will plot a point for each date which will be equally spaced. Right click chart and pick Chart Options from the context menu. On the scale tab set the axis type to category. Cheers Andy Janel wrote: > Hi, > > I am creating a chart that has week da...

DrawThemeBackgroundEx ---- problem
Hi Our application, is a drawing software developed in MFC in VC6. My problem is that the application is crashing when i maximize the application in Windows XP theme. It works fine in XP in Windows classic theme. I traced out that uxtheme.dll ( C:\WINDOWS\system32 ), function DrawThemeBackgroundEx is deleting a pointer which i use in my application. I never call any function DrawThemeBackgroundEx.... How can i block the call to DrawThemeBackgroundEx??? Pls help >Our application, is a drawing software developed in MFC in VC6. > >My problem is that the application is crashing whe...

concatenate problem
Is it possible to base a concatenation for address labels off a query? A couple years ago you really helped me fix our address labels with concatenation, and I have used it for many things but always based off the same model. Now I need something a little different but I am running into a roadblock. Basing the concatenation off the query, I can get the address to show up properly (one address per concatenation, instead of four times if four people live at an address), but the names don't show up. There is no error message or anything, the concatenation field is just blank....

MS Groove problem
Hi all, my computer crashed and i had to install a new hard drive. I've reinstalled Groove but had to create a new "participant" user account. It now shows my old account(manager) as Offline and asks me to verify the name conflict. I'm using Groove over shared computers vs an enterprise. How do i get access or reinstate my original user account as manager? Guessing once i do, i would need to close the newly created user account. Thanks for the Help!!! ...

Access Versions Problem
Hi I have Access 2002 installed and when I create a new database the file format is 2000 Why is that? Samuel Dear Samuel: If you navigate to Tools>Options>General, you can set the default format to Access 2002-2003, if you like. The default format of Access 2000 was probably done to maximize compatibility. HTH Fred Boer "Samuel" <samuel.shulman@ntlworld.com> wrote in message news:uUlY8MerHHA.4100@TK2MSFTNGP06.phx.gbl... > Hi > > I have Access 2002 installed and when I create a new database the file > format is 2000 > > Why is that? > &g...

Security problem
I have a problem can't seem to figure out. I am an admin, and I'm having some security issues with the our exchange 2003 server only. I have no problems with our Primary Domain Controller (w2k3 std) or our gateway server running ISA 2004 (w2k3 Std). From my XP workstation, if i try to remotely manage the Exchange server (via right click 'my computer'->manage->Action->connect to another computer) the mmc console comes up but if I try to review the event logs, or access the services list, or anything for that matter... I get an access denied error. If I remote desktop...

phone textbox default value problem
I have a phone field and I have a default area code set and when I tab to the field the area code is highlighted and I have to click off of it to enter data. How can I have it so when I tab to the field I can immediatly start typing the phone number after the area code? If the area code is different than the default I figure I could just back space and change it. 90% of the time the default will be correct. I have the input mask as !\(999") "000\-0000;0;_ and the default value as (916), I am leaving the formatting info in because I have to import the data and it has the...

Problem with Event handling in a custom control
Hi, I am building a GUI which uses the same combination of controls at multiple locations. For example, it has a custom gauge. This has a progress bar, a button ( allows the user to display the peak/rms/ instantaneous value of the parameter) and a label displaying the value. All three controls are surrounded by a group box. This combination is used on multiple tabs. To make my job easier, I built a custom control. I am able to layout the controls correctly but I am facing a problem when trying to handle the button click events. As I am assigning the resource ID to the button on initializatio...

Tools/Options/Calculation/Auto Problem
Whenever I start a blank spreadsheet or a cvs spreadsheet in Excel2000 the calculation mode is always manual. I always have to go to Tools/Options/Calculation and click on the Automatics box. If I start Excel/2000, it comes up with a blank spreadsheet called book1.xls I've tried saving the blank book1.xls in the windows/applications data/microsoft/excel directory as book1.xls with the Automatic box checked. But after I save the book1.xls in that directory and close Excel, when I start Excel again it comes up with a blank spreadsheet called book1.xls but the calculation mode is set to M...

CString (again)
I have a class: class TestClass{ public: TestClass(){}; virtual ~TestClass(){}; BOOL CalcArea(double * pArea); void ReversePoints(); void OrderFromLowest(); std::vector<CoordinateClass> Pts; double OrientationType; BOOL XFlip; BOOL YFlip; double LTilt; double RTilt; double Buffer; int Style; CString Name; }; Now when I go like this: TestClass * pNew = new TestClass; pNew->Name = "anything in here will cause an error"; At runtime i get an unhandled exception which is comign from CString::AssignCopy() How do i fix this? Can't seem to reproduce this ...