ZVON > References > Haskell reference
| Indexes | Syntax | Prelude | Ratio | Complex | Numeric | Ix | Array | List | Maybe | Char | Monad | >> IO << | Directory | System | Time | Locale | CPUTime | Random

Module: IO
Function: hGetPosn
Type: Handle -> IO HandlePosn
Description: Computation hGetPosn hdl returns the current I/O position of hdl as a value of the abstract type HandlePosn. If a call to hGetPosn h returns a position p, then computation hSetPosn p sets the position of h to the position it held at the time of the call to hGetPosn. Error reporting: the hSetPosn computation may fail with: isPermissionError if a system resource limit would be exceeded.
Related: hSetPosn

Example 1
File: /tmp/foo.txt : 

Hello, world!
Good bye!
Program source: 

import IO

main = do hdl <- openFile "/tmp/foo.txt" ReadMode
	  a <- hGetChar hdl
	  pos <- hGetPosn hdl
	  b <- hGetLine hdl
	  print (a,b)
	  
	  c <- hGetChar hdl
	  d <- hGetLine hdl
	  print (c,d)

	  hSetPosn pos
	  e <- hGetChar hdl
	  f <- hGetLine hdl
	  print (e,f)

Output: ('H',"ello, world!")

Output: ('G',"ood bye!")

Output: ('e',"llo, world!")




_____________________________________________
Reference Search | Sitemap | XML Glossary       ZVON | Systinet




Related sites:
  • dotNet Slackers - Your latest resource for ASP.NET
  • Dotnet Spider - Outsourcing and Offshore software development in India
  • XML - Xselerator, XSL Editor, BizTalk Utilities, XML Tutorials, Learn XML
  • Planet Source Code - The largest public source code database on the Internet
Domain Names conference call service UNLIMITED Web Hosting by HostDepartment Alojamiento Web answering service
MSN VoIP Internettelefonie Hosted Exchange, SDSL VoIP Internettelefonie AT VoIP Internettelefonie DE