Example #1
0
	public static int calcHighestId()
	{
		// goes through each line if the csv file, keeping track of the highest
		// id it finds. returns the highest id found in the csv file.
		int id;
		int highestId = 0;
		TextFile file;
		file = new TextFile(filepath, "r");
		file.openFile();
		do 
		{
			if (file.readChar() == ',') 
			{
				do 
				{
					id = file.readInt();
				} while (id == -1);

				if (highestId < id) 
				{
					highestId = id;
				}
				file.clearRestOfLine();
			}
		} while(file.endOfFile() == false);
		file.closeFile();
		return highestId;
	}