Its Me Christian wrote: > > Could someone please send me an example of how i could write something to a > file then read a line of the file :) > genobj.c (newest Oasis) if (!(fp = fopen(buf, "w+"))) { mudlog("SYSERR: OLC: Cannot open objects file!", BRF, LVL_IMMORT, TRUE); return FALSE; } <snip a bunch of stuff> fprintf(fp, "#%d\n" "%s~\n" "%s~\n" "%s~\n" "%s~\n" "%d %d %d %ld\n" "%d %d %d %d\n" "%d %d %d %d\n", GET_OBJ_VNUM(obj), (obj->name && *obj->name) ? obj->name : "undefined", (obj->short_description && *obj->short_description) ? obj->short_description : "undefined", (obj->description && *obj->description) ? obj->description : "undefined", buf1, GET_OBJ_TYPE(obj), GET_OBJ_EXTRA(obj), GET_OBJ_WEAR(obj), GET_OBJ_PERM(obj), GET_OBJ_VAL(obj, 0), GET_OBJ_VAL(obj, 1), GET_OBJ_VAL(obj, 2), GET_OBJ_VAL(obj, 3), GET_OBJ_WEIGHT(obj), GET_OBJ_COST(obj), GET_OBJ_RENT(obj), GET_OBJ_LEVEL(obj) ); <snip a bunch of stuff> fprintf(fp, "$~\n"); fclose(fp); check db.c for reading, its all over there (zones, world, obj, mobs, shops, etc) -- +---------------------------------------------------------------+ | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html | | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html | +---------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/04/01 PST