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: hSeek
Type: Handle -> SeekMode -> Integer -> IO ()
Description:

Computation hSeek hdl mode i sets the position of handle hdl depending on mode. If mode is:

 * AbsoluteSeek: the position of hdl is 
                 set to i.
 * RelativeSeek: the position of hdl is 
                 set to offset i from the current position.
 * SeekFromEnd:  the position of hdl is set 
                 to offset i from the end of the file.

The offset is given in terms of 8-bit bytes.

Error reporting: the hSeek computation may fail with: isPermissionError if a system resource limit would be exceeded.

Related:

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
	  hSeek hdl AbsoluteSeek 4 
	  b <- hGetChar hdl
	  print (a,b)
	  c <- hGetChar hdl
	  hSeek hdl RelativeSeek 3
	  d <- hGetChar hdl
	  print (c,d)
	  e <- hGetChar hdl
	  hSeek hdl SeekFromEnd (-3)
	  f <- hGetChar hdl
	  print (e,f)


Output: ('H','o')

Output: (',','r')

Output: ('l','y')




_____________________________________________
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
UNLIMITED Web Hosting by HostDepartment Alojamiento Web UK Domain Names glossary for conference call answering service
MSN VoIP Internettelefonie Hosted Exchange, SDSL VoIP Internettelefonie AT VoIP Internettelefonie DE