Control character manipulation

Hello

In a C++ program, I would like to change the string

"ty^Hypescript ^H ^H^H ^H^H ^H^H ^H^H ^H^H ^H^H ^H^
^H^H ^H^H ^H^H ^H^G^G^G^G^Gty^Hypescript ^H ^H^H ^H^H ^H^H ^H^M"

into the string

"typescript"


The letters like '^H', '^H^H', and '^G' represents some of the ANSI control characters such as backspace. (the characters are shown on VI editor.

So, I think it's possible to process control characters within a code, like a VT100 virtual terminal does.( In deed, I am not sure whether the process is done in a terminal, shell or whatever.

If you have a sample code or a function to suggest, please post them. Thank you.
0
anonymous (74722)
5/14/2004 4:36:04 AM
vc.mfc 33608 articles. 0 followers. Follow

1 Replies
593 Views

Similar Articles

[PageSpeed] 26

How about...

void StripCtrl( CString& strIn )
{
    CString str;
    int j= 0;
    while( j < strIn.GetLength() )
    {
        if ( strIn[j] == 0x08 )    // backspace
        {
            if ( j > 0 )
            {
                str= str.Left( str.GetLength() - 1 );
            }
        }
        // You can process the other control codes similar to above, I just
ignored them...
        if ( strIn[j] > 0x19 )
        {
            str += strIn[j];
        }
        ++j;
    }
    strIn= str;
}


HTH
-- 
============
Frank Hickman
NobleSoft, Inc.
============
Replace the _nosp@m_ with @ to reply.


"coolcoon" <anonymous@discussions.microsoft.com> wrote in message
news:B19C5452-EA26-46C8-8C66-64E99FE0F631@microsoft.com...
> Hello,
>
> In a C++ program, I would like to change the string
>
> "ty^Hypescript ^H ^H^H ^H^H ^H^H ^H^H ^H^H ^H^H ^H^H
> ^H^H ^H^H ^H^H ^H^G^G^G^G^Gty^Hypescript ^H ^H^H ^H^H ^H^H ^H^M"
>
> into the string
>
> "typescript".
>
>
>
> The letters like '^H', '^H^H', and '^G' represents some of the ANSI
control characters such as backspace. (the characters are shown on VI
editor.)
>
> So, I think it's possible to process control characters within a code,
like a VT100 virtual terminal does.( In deed, I am not sure whether the
process is done in a terminal, shell or whatever.)
>
> If you have a sample code or a function to suggest, please post them.
Thank you.


0
5/14/2004 6:11:44 AM
Reply:

Similar Artilces:

determining which control fires a message
Hello, I have a simple dialog app with a number of buttons. Each button performs basically the same function. I want to have each BN_CLICKED message call the same function, determine which button was pressed, and act accordingly. I can't seem to find a way to trace back to the message- generating button's ID. Is this possible? Thanks, J. Look up ON_CONROL_RANGE macro. Ali R. "J Crafton" <jccrafton@yahoo.com> wrote in message news:039f01c39e50$cbce67e0$a101280a@phx.gbl... > Hello, > > I have a simple dialog app with a number of buttons. &g...

How to control your Office 2011 update installation.
Dear friends: Today, I have in my Mac the following components of Office 2008 installed: Word, Excel, Powerpoint and Entourage. I want to upgrade this installation to Office 2011 but, in order to save disk space, avoiding the duplicate products. I want to have only Word (2011), Excel (2011), Powerpoint (2011), Outlook (2011) and Entourage (2008), of course without loosing my email or office data. Is this possible, or I will end with *all* the component products duplicated? When I updated my original Office 2004 installation to Office 2008 some years ago, I didn't get any product duplic...

Spcecial character for Command Button's Caption
How can I use special characters, esp the ampersand (&) on a command button's caption property? I tried with forward and back slash but it does not work. Any suggestions are very much appreciated. Thank you. Use two ampersands to display an ampersand in the command button's caption. Carl Rapson "Samantha" <Samantha@discussions.microsoft.com> wrote in message news:86FDD84A-59D5-4571-B9D4-3A148B625526@microsoft.com... > How can I use special characters, esp the ampersand (&) on a command > button's > caption property? I tried with forward an...

control list
I am not able to see my control list (by mistake i have press the del button) so that i can add control in my dialog box,What option should i use to display it again. Thanks > I am not able to see my control list (by mistake i have press the del > button) so that i can add control in my dialog box,What option should i > use to display it again. In VS2005, its ToolBar under View menu or hit Ctrl+Alt+X (unless you have remapped this sequence). --- Ajay Your message is kinda confusing. Are you missing a control from your dialog box or are you missing a control from the Toolbox? Al...

Special Characters in Headers and Footers
Using Excel 2000 in a Win 200o O/S, is there any way special characters such as the ampersand (&) can be displayed in a header and footer? -- LPS Use two in a row as "ABC"&&[Date] best wishes -- Bernard V Liengme www.stfx.ca/people/bliengme remove caps from email "LPS" <LPS@discussions.microsoft.com> wrote in message news:7AB8B0DE-0DF3-4F46-BABC-F5DCB2C50A6A@microsoft.com... > Using Excel 2000 in a Win 200o O/S, is there any way special characters > such > as the ampersand (&) can be displayed in a header and footer? > -- > LPS ...

Text in pivot table limited to 255 characters
I am using a pivot table as an efficient way to aggregate text responses from a large data set. However, the pivot table cuts off the text after the first 255 characters (similar to when you copy a worksheet by using the move/copy option). How can I overcome this? I have tried putting the pivot table on the same sheet as the dataset, but that does not work. I should also note that these pivot tables are then fed into an automated report through a complicated set of VLOOKUPs, etc. The pivot table aggregates several questions and responses from many areas of the datset into one discr...

ActiveX controls in vc++ #2
If i write some independent stuff to activeX Class member function its working fine. The problem is with when i add a member function which inturn call a function in a dll file,thats why i am getting the error Self regitration failed when adding that ocx control to other appliaction.How can i solve this problem.I tried with regsvr32 to register it.but the same problem is repeated. How can i solve this problem?Please reply me... -- Adarsh ...

To retrive a item from a list view control
hi all.. i have put a list viewcontrol in my dialog box.. it has two coloumns.. now i need to select the index of the item that has been clicked i tried with ON_NOTIFY(LVN_ITEMCHANGED,ID,OnSelectList)-> Message the control is going to the function OnSelectList there i tried with GetItem(),Item and isubitem from NMLISTVIEW structure.. but i am not geting the exact index.. Any help Plz.. Thanks in Advance.. Vj Steps:- 1) Add a dialog 2) add a list control on it and have a subclass CMyListCtrl 3) In OnInitDialog(...) of dialog add this code which will add 4 columns and 4 r...

Using a Space in Webbrowser Control
Hello: As usual, I've run into a problem with something that is probably so simple... any help is appreciated. I'm using the webbrowser control with the navigate method. The url I'm using needs a space (which I know is not normally allowed, but it works directly in firefox and IE). Here's some sample code: ------------------------------------ strWebPage = "http://www.imdb.com" &" ?" & Text2.Text txtURL.Text = strWebPage Web1.Navigate txtURL.Text Do While Web1.ReadyState <> READYSTATE_COMPLETE DoEvents Loop DoEven...

Dependent List in Control Combo-Box
Can any body tell me that is it possible to create dependent lists i Combo-boxes ? Thank -- Message posted from http://www.ExcelForum.com Hi Abdul Yes this is possible, here's a sample code with combined combo boxes from the Control tools box. Make sure you have your first list of values in column 1 and other dependant values in the adjacent columns Place code on your first combo(please note no headers used in the data lists): Private Sub ComboBox1_Change() MajListes Me.ComboBox2, ComboBox1.ListIndex End Sub Private Sub MajListes(Cbbx As MSForms.ComboBox, ValeurIndx As Integer) Const P...

trouble docking control bars vertically on the MainFrame
I'm attempting to attach a series of dockable control bars (of type CDialogBar) to the MainFrame of my application. The dialog bars should be placed in a single column on the right hand side of the MainFrame (i.e. each dialog bar should be docked immediately above the next). Unfortunately, when I add the dialog bars to the MainFrame, they get placed side by side (horizontally, instead of vertically) To change this behavior, I've tried the following .. 1.) setting the bar styles using the following flags CBRS_ORIENT_VERT vs. CBRS_ORIENT_HORZ 2.) overriding CControlBar::CalcDynamicLa...

Insert GIF animated to RichEdit control....Could You Help Me Please
I have a problem on inserting a GIF to richedit, the problem is not viewing it, but it is playing it at richedit. I have a class that can play GIF animation, and I have converted it to an activeX, if I could pass this object to richedit control, and there I call its method so it can animated, do you have any suggestions on this. I wonder how MSN 6.0 plays EmotIcons. if you have other solutions, please help me on it. ...

Unprinted characters in a report
I have a contact management database which also handles communications. I have saved a communication with Romanian characters in it but when it comes time to print the report many of the characters are replaced with '?'. What is happening and is there any way of getting the report to display correctly? For example "E=BAti tu bolnav" which means "Are you sick?" prints as "E? ti tu bolnav". I am using a bound text box to a memo field. Thank you very much in advance turned out that the problem was to do with leban's RTF control. I missed the problem...

window control box
Hi, In our application, we are using a visio window to display a tree view of components in diagram. Is there a way to turn off the control box of the visio window? Thanks in advance. Regards, Siri ...

Manipulate data
I have a db that's primary goal in life is to calculate payroll salary's, email info to staff and create budget assumptions. Our payroll system has no way of storing all of the rules we have so I have created the db to fill the void. At this time I pull all the information into access and then run through about 13 queries to calculate all of the different rules. I am just wondering if there is a better way to do this. Maybe passing all of the information into module doing all the calculations and returning each persons values. If that is the best way how would I pass...

How do I limit the number of characters in a cell?
When try to limit the number of characters allowed in cell by going through the data/validation menu, it still allows more than the number of characters than I specified. I don't get it :( ...

Sort order for characters & symbols
Hi! I was just wondering if anybody knows of a character that comes AFTER z in the sorting order? Basically, I have a name defined list of members of staff, which I use as a dropdown menu for entering data into certain fields. However, we take on new staff all the time, and so I will need to be adding names to that list all the time. Because this group is also used as a lookup vector, it needs to be in alphabetical order too (and I'd prefer it that way anyway). I did look at the "Update Multiple Validation Lists" file at http://www.contextures.com/excelfiles.html but I...

Recover Ad/domain controller test new hardware
I have been testing Recovering from a hardware failure of the AD. I have been trying to follow these instructions from MS. http://support.microsoft.com/kb/263532/en-us I have backed up the existing AD, Installed win2003 on a new computer, then I did a restored to the New server with different hardware using NTBACKUP. Now when I boot I get an error which I presume means that the hardware has changed. So MS suggests, **************** To resolve the issues that are described in scenarios 2 and 3, perform an in-place upgrade repair. To do this, follow these steps: Start the compute...

HELP: Excel userform version control issue
Hi All, I have an excel userform that is posted on my companys intranet. The issue I am having is, users are saving this form to their hard drive and then using it(Instead of launching it everytime from intranet), SO basically when I have a new version of form on intranet they still use the old version as they have a habbit of saving it on their hard drive. Is there a way to resove this? something like they would see a popup message saying that "This is an older version that you are using, Please launch the form from Intranet for newer version". Thanks in advan...

Get the handle of controls not reachable with the mouse
Hello, An application has a class #32770 window (Dialog) which contains controls identified by their ControlId. I have to write the code to get their handle. But these controls can't be reached by the mouse unless you click on a "Modify" button the application furnishes and I must get the handles without entering that"Modify" mode. I use the WindowFromPoint(x,y) fonction, fired by the OnMouseMove event : it returns the handler of the #32770 window even when the cursor is upon one of these controls inside the #32770 window : the WindowFromPoint(x,y) fonction doesn&#...

Ever noticed this discrepency of events for the Navigation control in a DAP?
There seems to be only one event for a Navigaion control provided by the Microsoft Office Web components. You can see it if you open a DAP in design view and go to the Microsoft Script Editor. When the page comes up on the left select Script Outline. Then find the Navigation Control under Client Objects & Events which will be named something like TableNameNavigation. Click the expand button + and you will see it has only one event called ButtonClick. Well that's cool trouble is it does not work. Why? Open a DAP in design view and in a script section of the page type the name of the N...

How to show "System" icon from Control Panel on Win CE 5 desktop
Hi, From MSDN, I know that the "System" application is a .cpl file which provides Control Panel functionality. How do I add that file to my OS design so that the "System" icon from Control Panel will show on the desktop? Thanks a lot. JH Hi, Here is the procedure, 1) Open a notepad and add the following text 35#"ctlpnl.exe" \Windows\cplmain.cpl,6 2) Save it as a .lnk file. This is a shortcut file to invoke system applet. 3)Just for the reference name it as system.lnk. 4) Copy this file to your \WINCE600\PLATFORM\<your BSP>\Files fo...

Arrow character showing up with some cross-references
A number of documents that we have been working on lately have an arrow character (we think it's Unicode character 21B1, Upwards Arrow With Tip Rightwards) immediately to the left of _some_ of the cross-references. Picture the grey shading that indicates the cross-reference; the arrow shows up smack dab on the left side of the grey shading. The problem is that it only shows up (on screen and when printed) when we view/print the document within Documentum. The same Word file on my desktop appears to have no such arrow and no arrow is printed when I print from the desktop. A PD...

Outlook View Control and Outlook 98
Hi all, Developing a project that integrates Outlook data (mail, calendars) in a web site, we found out that a large potion of our client's client machines are stuck with Outlook 98 for a while. This does not work very well with OVC since its buggy and/or not at all supported in this version of Outlook. This is fine. But does anyone know of a list or overview, or some kind of specification that shows what _does_ work in Outlook 98? Obviously there is no other proper solution apart from upgrading the clients, but its a lengthy process in our client's organization and we want to...

Swedish characters in the Display name #2
I have a problem with Swedish characters in the senders' names on outgoing e-mail. Previously we have formatted the display names like: Last name, First name This is causing problems for some external recipients, since their e-mail program reads this as two addresses (Last name as one name and First name as another) I tried changing the display name for one user to "First name Last name" instead, but then the Swedish characters are not shown when he/she sends an external e-mail. Example: "Åke Jönsson" becomes "Ake Jonsson" or "Åsa H...