|
-
Mar 7th, 2001, 04:29 PM
#1
Thread Starter
Hyperactive Member
I have made a function for displaying text basing the coordinates on a given XY point:
Code:
void xytext(int x, int y, char *text)
{
move_to(x,y); /*move graphics device to x,y */
plots(text); /*plots the text string */
}
This will plot the given text to a given point. This is intended for powerc(you can use another compiler) or any compiler that doesn't have the function outtextxy();
Here is my problem: I would like to turn an integer so I can put it into a string, to display it using this function. I'm not good with strings, so can you tell me how I could add that string(converted int) to the end of another string(a phrase), so I can do something like this:
"Mouse X = " + (Interger(say 77) to string)
"Mouse X = " + "77"
"Mouse X = 77"
You get it? Please help me on this. It's EXTREMELY IMPORTANT!!!
-
Mar 7th, 2001, 05:08 PM
#2
Monday Morning Lunatic
PHP Code:
char buf[40];
itoa(number, buf, 10);
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Mar 7th, 2001, 05:26 PM
#3
Thread Starter
Hyperactive Member
Thanks, Parksie!!!
Now how would I add that to the end of a string? (add 2 strings into 1)
-
Mar 7th, 2001, 05:36 PM
#4
Lively Member
Use the "strcat" function.
Code:
.
.
.
char buff[10] = "Hello ";
char buff2[10] = "world!";
strcat(buff, buff2);
.
.
.
-
Mar 7th, 2001, 05:39 PM
#5
Monday Morning Lunatic
Also, sprintf should help here:
Code:
char buf[100];
sprintf(buf, "Pos: (%d, %d)", xpos, ypos);
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Mar 7th, 2001, 05:59 PM
#6
Thread Starter
Hyperactive Member
OK, That works. Now, I try to switch into a mode using interrupts. This causes my function to not work. Any ideas??? Does anyone have a substitute for my function that will work?
-
Mar 7th, 2001, 06:03 PM
#7
Monday Morning Lunatic
I think you need to restore the interrupt state after changing...not totally sure...it's just what I remembered from browsing that VBE documentation ages ago.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Mar 7th, 2001, 06:12 PM
#8
Thread Starter
Hyperactive Member
You mean VESA? I was using those VBE modes. Can you figure out how to restore the interrupt states? I'll try as well. Thanks
-
Mar 9th, 2001, 04:36 PM
#9
Thread Starter
Hyperactive Member
Ok... Maybe the PowerC print functions aren't good enough. Does anyone know the source code for outtextxy(int x, int y, char *text); , or a similar function? This is higher priority than my thread's actual topic. Please help...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|