Thread: authentication program

  1. #1
    Registered User
    Join Date
    Aug 2005
    Posts
    1

    authentication program

    hello
    i'm pretty new into programming and i need help
    with something like authentication program

    it should works like that:

    there are directories like this
    c:\
    |
    auth[dir]
    / \
    john[dir] cow[dir]
    | |
    auth.dat auth.dat
    auth dat include string "authlevel={0 or 1}"

    now program search for auth.dat files in subdirectories
    of auth directory,then check auth level in auth.dat files
    and print different output for each auth level

    for now i have only this part of code:
    Code:
    #include <windows.h>
    #include <stdio.h>
    #include <stdlib.h>
    
    int main()
    {
        WIN32_FIND_DATA FindFileData;
         
        HANDLE hFind = FindFirstFile("c:\auth\*.dat", &FindFileData);
        
        if (hFind != INVALID_HANDLE_VALUE) {
        do 
        {
            if( FindFileData.dwFileAttributes == FILE_ATTRIBUTE_DIRECTORY )
             printf("<dir>");
            printf ("%s\n", FindFileData.cFileName);
        } 
        while (FindNextFile(hFind, &FindFileData));
    }
        FindClose(hFind);
    
        return 0;  
    }
    as you see it only search for *.dat files in c:\auth\ dir

    so my problem is: how to make this program search every dir
    in c:\auth\ for dat files and read them ?
    thanks in advance

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    First, change \ to \\
    Second, read http://faq.cprogramming.com/cgi-bin/...&id=1044780608
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 07-24-2008, 06:05 AM
  2. Need help with a program, theres something in it for you
    By engstudent363 in forum C Programming
    Replies: 1
    Last Post: 02-29-2008, 01:41 PM
  3. Replies: 4
    Last Post: 02-21-2008, 10:39 AM
  4. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM