Jump to content

_WinAPI_ReadFile


Recommended Posts

HiHo,

can any of the real cracks here give me a hand and help me adjusting the code below to access a file?

#include <WinAPI.au3>

Global $output, $InputFile, $hFile, $tSize, $tBuffer, $pBuffer, $bread = 0, $filesize

$InputFile = "test.txt"

$hFile = _WinAPI_CreateFile($InputFile, 2, 2)
$filesize = _WinAPI_GetFileSizeEx($hFile)
$tBuffer = DllStructCreate("char Text[" & $filesize & "]") 
$pBuffer = DllStructGetPtr($tBuffer)
_WinAPI_ReadFile($hFile, $pBuffer, $filesize, $bread)
_WinAPI_CloseHandle($hFile)

$output = DllStructGetData($pBuffer,"Text")

MsgBox(0,"",$output)

What I want is a way to access a file and read from position y to x.

Searched the forum without much success, all I came up with is the stuff above ( :) ).

Thanks in advance and cheers

Poly

This post will be edited again by Polyphem: Tomorrow, 11:55 AM
Link to comment
Share on other sites

Upsa, guess I have to do a lot more reading before replying :)... saw that post but didnt read it thoroughly enough. Thanks for the hint...

This post will be edited again by Polyphem: Tomorrow, 11:55 AM
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...