I need to ream the file into this two dimentional char array. here is my code, it is well commented and explians everything in detail:
import java.io.*;
import java.util.*;
class XpInputStream
{
public static void main (String args[]) throws IOException
{
String FilePath = "C:\\Users\\Admin\\Desktop\\pagefile1.sys";//File Path to the page File
DataInputStream input = new DataInputStream(new BufferedInputStream(new FileInputStream(FilePath)));
//Creates an input stream called input - sets it to a data input stream that has a File input stream
//wraped in a buffered input stream. File path set to String File Path - set above
char sectors[][];//two dimentinal char array to store the Sector number followed by 1024 bytes of data in that sector
int r; //int r to hold the value of the byte
while ((r = input.read()) != -1)
{
for(int SectorNumber = 0; SectorNumber < 10/*will be set to the lenght of the file*/; SectorNumber++)//works out
//which sector number the program is reading. The lenght of the File. Increments sector number after each
//sector has been read and stored
{
for(int i = 1; i<1024; i++)//count to the size of a sector. start at position 1 and works up to 1024
{
sectors[SectorNumber][r] =;//this is where the problem lies and I am unsure how to get the data read into r stored into r's position in the array.
}
}
}
}
}
Thanks for your help, it is very much appreciated
Cookie_272
*Edited: Intermediate ranking ?
This post has been edited by pbl: 16 April 2009 - 05:46 PM

New Topic/Question
Reply



MultiQuote




|