Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Beginner question:whats a handle

Status
Not open for further replies.

pigsie

Programmer
Dec 19, 2000
307
GB
Hi

I have been reading some fo the faqs and post to learn a bit about c++ I often see the term 'handle' what does this mean? Thanks
 
Well as you know a handle is used to pick up a cup, kettle, a garden fork, etc.

So in the context of programming a handle is much the same thing, with the exception that the handles are attached to devices. Printers, Screen, Files etc.

If you open a file for example you will get a file handle in return. You then use this file handle gain access to the file stream, for reading and writing. The same handle is used to close the stream as well.

HTH

William
Software Engineer
ICQ No. 56047340
 
SO handles wouldnot be used to refer to object references?

Or could you use it in this context as well?

Thanks
 
Yes I suppose the theory you could apply this logic. At the end of the day the word handle by definition is self explanitory.

If you mean:

CMyClass* pClass = new CMyClass() ;

then pClass (the pointer) is I guess a handle, since it allows you to 'handle' the reference to the class.

If this isn't what you mean the please post an example.

HTH
William
Software Engineer
ICQ No. 56047340
 
Thats exactly what i meant thanks for shedding some light on this
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top