Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


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

Posted on 2004-04-09
Medium Priority
Last Modified: 2010-04-15
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

Question by:ico2
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
LVL 46

Expert Comment

by:Kent Olsen
ID: 10792782
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,

Expert Comment

by:Avik Dasgupta
ID: 10792791
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 (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.


Author Comment

ID: 10792934
avik77-that produces tons of errors with my compiler.

undefined symbols and invalid structures etc.
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Expert Comment

by:Avik Dasgupta
ID: 10793017
>>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.


Accepted Solution

Avik Dasgupta earned 60 total points
ID: 10793076
>>avik77-that produces tons of errors with my compiler.
union REGS i,o; // globally
and include dos.h


Author Comment

ID: 10794109
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.

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial is posted by Aaron Wojnowski, administrator at  To view more iPhone tutorials, visit This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
The goal of this video is to provide viewers with basic examples to understand and use structures in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use for-loops in the C programming language.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question