ReplaceCellNum(oldph, newph) { new File: file2 = fopen("tmpNumberList.cfg", io_write); print("1"); new number; new string[512]; new PHList[256]; format(string, sizeof(string), "%d\r\n", newph); print("2"); fwrite(file2, string); print("3"); fclose(file2); print("4"); file2 = fopen("tmpNumberList.cfg", io_append); print("5"); new File: file = fopen("NumberList.cfg", io_read); print("6"); while(fread(file, string)) { print("6.1"); strmid(PHList, string, 0, strlen(string)-1, 255); print("7"); number = strval(PHList); print("8"); if (number != oldph) { format(string, sizeof(string), "%d\r\n", number); print("9"); fwrite(file2, string); print("10"); } } print("11"); fclose(file); print("12"); fclose(file2); print("13"); file2 = fopen("NumberList.cfg", io_write); print("14"); file = fopen("tmpNumberList.cfg", io_read); print("15"); while(fread(file, string)) { print("16"); strmid(PHList, string, 0, strlen(string)-1, 255); print("17"); number = strval(PHList); print("18"); if (number != oldph) { print("19"); format(string, sizeof(string), "%d\r\n", number); print("20"); fwrite(file2, string); print("21"); } } print("22"); fclose(file); print("23"); fclose(file2); print("24"); fremove("tmpNumberList.cfg"); print("25"); printf("ph %d replaced with ph %d in NumberList.cfg", oldph, newph); return 1; }