> What I want to do, however, is make it so that you can customize parts > of the map, and I want to do a parsing of the description itself. By > the time the parsing would be called, the description would already be > loaded into the room structure, and the room file closed. What I want > to do is treat the description pointer as a file stream and therefore be > able to use the get_line() and fread_string() functions. Is this > possible, or would I have to re-write those functions to get that > capability. Er. Why would you want to do that? .. first things first First, you can't just store the description pointer as a file pointer. Well, in fact you can, since pointers are all the same size, and most functions treat FILE pointers identically to character arrays... but you shouldn't, unless you take very good care of the memory the pointer actually points to. Second, if you did replace the description string with a file pointer, you'd need to have an open file pointer for each room. You probably are not allotted that many file descriptors, and either way, it's wasteful. You could just have 1 pointer per file and save the offset. Still, this is quite wasteful. Third, you'd have to read from a file every time you wanted to display the text description. That's a huge hit, especially if you have anyone speedwalking through your mud. If all you need to do is be able to parse a string a line at a time, I'd just write up a function to actually do that. get_line() already works for that pretty well, you may just want to rewrite that for character arrays instead of a file. Just make sure you don't directly modify the actual character buffer, since it's your room description. Some other functions you may want to check out: strtok (break on a newline) fgets PjD -- +---------------------------------------------------------------+ | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html | | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html | | Newbie List: http://groups.yahoo.com/group/circle-newbies/ | +---------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 06/25/03 PDT