• C

newbie ?s: using the mouse and accessing text files oh and one question about strings

how do i dispay a mouse cursor in my programs? and how do i get my program to find out where it is on the screen. how do i read a text file into a string? and how do i find out how many charachters there are in a string.

i know these should be in seperate questions but i do not have enough points

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Kent OlsenDBACommented:
Hi ico2,

The simple question first.  :)

  strlen (String);

This will return the number of characters in the string.  Note that the string is actually one character longer than this!

Cursor management varies with the operating system and device interfaces.

What system are you using?

Good Luck,
Avik DasguptaCommented:
Assuming u to be working in DOS environment..
For displaying mouse cursor u require to work with interrupts using function int86 provided in dos.h. u can check the help for its format.
First u have to initialise the mouse cursor using
int initmouse()
if return value is 1. then show/display mouse pointer by
void showmouseptr()
u can get mouse position by
void getmousepos()
X and Y are the(x,y) co-ordinates on the screen. Declare X,Y as global variables to always get the mouse cursor position on the screen.

Here i.x.ax (say) means register A (16 bit).
and int86 calls with 0x33 as the interrupt number of the mouse service routine. It is multiplied by 4 to give the location of the ISR of mouse.

ico2Author Commented:
avik77-that produces tons of errors with my compiler.

undefined symbols and invalid structures etc.
The Firewall Audit Checklist

Preparing for a firewall audit today is almost impossible.
AlgoSec, together with some of the largest global organizations and auditors, has created a checklist to follow when preparing for your firewall audit. Simplify risk mitigation while staying compliant all of the time!

Avik DasguptaCommented:
>>how do i read a text file into a string?
u can do a character wise copy from ur text file to a string, or u can find the length of the input text file, and copy block to a string buffer using fread.

Avik DasguptaCommented:
>>avik77-that produces tons of errors with my compiler.
union REGS i,o; // globally
and include dos.h


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ico2Author Commented:
ok i had to edit the code a bit to make it compile. but it works now. thanks very much.

thanks also to kdo but i can only credit one person.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.