why when i am trying to print the character at a particular place in the file it gives me a '?' instead of the 'Z' i'm looking for. there are no ?'s in the entire file so I dont know what the deal is is it a typecast error??? thanks
i must be a lepar or something, either that or my questions are too difficult for this board cause no one seems to answer my questions.... please someone ...anyone..
heres the code so far
import java.io.*;
import java.util.*;
public class injRecFix{
static PrintWriter prntWrter;
public static void main(
String[] args){
char[] chBuffer =null;
boolean bReadFile = false;
String sINFileName = null;
String sOUTFileName = null;
int i;
int iSize = 0;
char chIsIt = 0;
InputStream fin;
File outputFile = new File("newPunchFile.txt");
if(sINFileName == null)
sINFileName = "Punch.001";
try {
fin = new FileInputStream(sINFileName);
prntWrter = new PrintWriter(new FileWriter(outputFile));
} catch (IOException except) {
sINFileName = "Punch.001";
try {
fin = new FileInputStream(sINFileName);
} catch (IOException eIO) {
fin = null;
}
}
if(fin != null) { // dumping PunchFile into chBuffer
try {
chBuffer = new char[fin.available()];
int iC = 0;
while(iC < chBuffer.length) {
i = fin.read();
chBuffer[iC] = (char)i;
iC++;
}
fin.close();
bReadFile = true;
} catch (IOException except) {
bReadFile = false;
}
}
if (bReadFile) {
// Convert buffer into a string.
String sBuffer = new String(chBuffer, 0, chBuffer.length);
iSize = sBuffer.length();
System.out.println("the length of the file is: " + iSize);
System.out.println("the length of the Z is: " + (iSize - 10) );
chIsIt = ((char)(iSize - 10));
System.out.println("a " + chIsIt + " is at that space");
// sBuffer.charAt(812)
//System.out.println(sBuffer.length());
}
}//end main()
}//end class injRecFix