Computer Science Canada Question about chars |
Author: | JR [ Sat Nov 22, 2008 1:10 pm ] |
Post subject: | Question about chars |
Hey i'm making a small one line text editor. in my code i have insert mode and overstrike mode. so lets say i have some text: abcdefX Y String length is 20 chars for example how do i make it add characters to it after the X(end of text, but not the length of the whole string, just used as example) it works perfectly when i try to edit the text itself or enter the characters on the X or before, but when i move to Y for example it doesn't display the characters i enter. if you need to see the code i'll post it up. |
Author: | md [ Sat Nov 22, 2008 2:47 pm ] |
Post subject: | RE:Question about chars |
I am unsure of your question. Are you wondering how to insert text into the character array? Or is this a UI issue? And code would be nice. |
Author: | JR [ Sat Nov 22, 2008 4:36 pm ] | ||
Post subject: | Re: Question about chars | ||
this is not UI, just a simple console 1 line editor. lets say the Array is 50 chars, but only 30 are used i can insert chars into the 31st position, but if i move over to the 32nd -49th i cant insert anything. here is my edit function where all the text is inserted etc. se - the string slen - string length flen is the field length, i use a field to where i write the text. *start is where the cursor starts in the field *offset is the location of the text corresponding to the field ctype - is for later use, not implemented yet.
|
Author: | md [ Sun Nov 23, 2008 2:33 pm ] | ||
Post subject: | RE:Question about chars | ||
I'm still not sure I understand the question, if you are asking how to insert characters into a char* based string it's pretty simple
Then you either increase the position that you are inserting a character in for every character, or do it the easy way and reverse the string you are inserting. |
Author: | DemonWasp [ Tue Nov 25, 2008 11:43 pm ] | ||
Post subject: | RE:Question about chars | ||
md, I think you mean:
|