home *** CD-ROM | disk | FTP | other *** search
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <io.h>
- #include <share.h>
- #include <fcntl.h>
-
- #include "C:\IBMCPP\BBSDef.h"
-
- void LoadConfig(unsigned short NodeNum);
- void ItoaPad(unsigned short Value, char *String, unsigned short Pad, char PadChar, unsigned char Radix);
- void ToUpper(unsigned char *String);
- unsigned char GetFileNameStartPos(unsigned char *Path);
-
- struct GConfigRecord GConfig;
- struct NConfigRecord NConfig;
-
- #define NODETECTCONFS
- #include "C:\IBMCPP\BBS\LOADCNF.C"
-
- unsigned int main(void)
- {
- unsigned char FileName[128];
- signed int Handle;
-
- struct UserRecord User;
-
- #ifdef __IBMC__
- setvbuf(stdout, NULL, _IONBF, BUFSIZ);
- #endif
-
- LoadConfig(1); /* Load config for node 1 */
-
- strcpy(FileName, NConfig.MainDir);
- strcat(FileName, "USERS.BAK"); /* Importante! */
-
- if ((Handle=sopen(FileName, O_BINARY | O_RDONLY, SH_DENYNONE))==-1) {
- puts("* Failed to open users.dat");
- return EXIT_FILEERROR;
- }
-
- while (read(Handle, &User, sizeof(User))==sizeof(User)) {
-
- /* All your own stuff goes here! */
-
- if (User.Killed) continue; /* Do not count killed users */
- printf("User: %s\n", User.Name); /* Example */
-
-
- } close(Handle);
-
- puts("* Done!");
- return EXIT_NORMAL;
- }
-
-
- void ItoaPad(unsigned short Value, char *String, unsigned short Pad, char PadChar, unsigned char Radix)
- {
- unsigned char Temp[10];
- unsigned short i;
-
- String[0]=0; /* Initialize String */
-
- itoa(Value,Temp,Radix);
- if (strlen(Temp)<Pad) {
- for(i=0;i!=(Pad-strlen(Temp));++i) {
- String[i]=PadChar;
- } String[i]=0;
- }
- strcat(String,Temp);
- return;
- }
-