Code: Show/Hide void botInfo::gotCommand(Player *p, Command *c) ... case OP_Player: { if (c->check("staff")) { sendPrivate(p, "start"); char line [256]; ifstream staff; staff.open("staff.txt"); if (!staff) { sendPrivate(p, "Error loading staff.txt"); } staff>>line; while (!EOF) { sendPrivate(p, line); staff>>line; sendPrivate(p, "loop"); } staff.close(); sendPrivate(p, "end"); } |
Code: Show/Hide while (!staff.eof()) |
Code: Show/Hide case OP_Player:
{ if (c->check("about")) { sendPrivate(p, "I display the staff list."); } if (c->check("version")) { sendPrivate(p, "staff.dll by Cheese"); } if (c->check("staff")) { ifstream staff; staff.open("staff.txt"); char line [256]; while (staff.getline(line, 256)) { sendPrivate(p, line); } staff.close(); } } |
Code: Show/Hide if (staff.bad())
{ sendPrivate(p, "Staff.txt is missing"); } |