2 questions: directory search and user creator
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix Programming > 2 questions: directory search and user creator




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    2 questions: directory search and user creator  
darkchild50@gmail.com


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
11-17-05 01:48 AM

Q1. i have found a good number of directory display programs but cant
seem to fiugre out how to find a file useing a simmalir program. any
ideas.

ps. i run fedora core.

Q2. im trying to impliment a program that looks in a file for a list of
usernames and passwords in the format
username1 password1
username2 password2
ect.
the code i wrote to do this is:

#include <stdio.h>

int main(){
FILE *fp;
char ch;

fp = fopen("users.cfg", "r");
ch = fgetc(*fp);
while(ch != EOF){
while(ch != " "){
/* this part needs to add th char ch to a string usrn*/
}
while(ch != "\n"){
/* this part needs to add th char ch to a string pass*/
}
}
}

any ideas?


- darkchild






[ Post a follow-up to this message ]



    Re: 2 questions: directory search and user creator  
SM Ryan


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
11-17-05 01:48 AM

darkchild50@gmail.com wrote:
# Q1. i have found a good number of directory display programs but cant
# seem to fiugre out how to find a file useing a simmalir program. any
# ideas.

You might want to include at least partial code.

# Q2. im trying to impliment a program that looks in a file for a list of
# usernames and passwords in the format
# username1 password1
# username2 password2
# ect.
# the code i wrote to do this is:
#
# #include <stdio.h>
#
# int main(){
# FILE *fp;
# char ch;
#
# fp = fopen("users.cfg", "r");
# ch = fgetc(*fp);
#    while(ch != EOF){
#       while(ch != " "){

You're comparing a character to a string address. To get the
character codes of space and newline use single quotes,
' ' and '\n'. You might want to review the distinction of
single and double quotes in C.


#       /* this part needs to add th char ch to a string usrn*/
#       }
#       while(ch != "\n"){
#       /* this part needs to add th char ch to a string pass*/
#       }
#    }
# }

--
SM Ryan http://www.rawbw.com/~wyrmwif/
I think that's kinda of personal; I don't think I should answer that.





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 04:33 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register