Line Read With Spaces

I am currently developing a website for java programs to be submitted and graded by a teacher…

the teacher grades on if the code works as well as the code formatting…

i need a way to correctly read in the line with all of its integrity (spaces tabs etc.)

example:

Student 1:
public class HelloWorld {
public static void main(String[] args) {
System.out.println(“Hello, World”);
}

}

Student 2:
public class HelloWorld {
public static void main(String[] args) {
System.out.println(“Hello, World”);
}
}

student one will receive a high grade because his is formatted correctly

my current code

[php]

$handle = @fopen("$my_path", “r”);
if ($handle) {
while (($buffer = fgets($handle, 4096)) !== false) {
echo $buffer. ‘
’;
}
if (!feof($handle)) {
echo “Error: unexpected fgets() fail\n”;
}
fclose($handle);
}

echo "<br />";

}
[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service