Sponsored Content
Full Discussion: I/O on File
Top Forums Programming I/O on File Post 302405718 by italian_boy on Friday 19th of March 2010 05:47:59 PM
Old 03-19-2010
I/O on File

Hello everybody... In my client - server application I decided to save user name and password in a file by the system call creat(), write().
Code:
 recv(i,buf,sizeof(buf),0);
             result=write(ds_user,buf,sizeof(buf));
                          if (result==-1){
                              printf("error on write");
                              exit(1);
                            }

Now there is a problem in the client-autentication and the next registration-autentication becouse I don't know very well how to manage the file:
This is the autentication code but it's not work
Code:
recv(i,buf,sizeof(buf),0);
char buffer[40];
result1=(ds_user,buffer,40);
printf("%s",buffer);
if (result1==-1){
   printf("error on read");
   exit(1);
 }
   if (strcmp(buf,buffer)==0){
    send(i,"/ok",MAX,0);

where the problem?? is there someone that has got some good example with I/O file?? For example if I want to start reading or writing not at the begin but for example in the middle of the file or in the second row or at the fifth word???
Thank you very much!
 

3 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Match list of strings in File A and compare with File B, C and write to a output file in CSV format

Hi Friends, I'm a great fan of this forum... it has helped me tone my skills in shell scripting. I have a challenge here, which I'm sure you guys would help me in achieving... File A has a list of job ids and I need to compare this with the File B (*.log) and File C (extend *.log) and copy... (6 Replies)
Discussion started by: asnandhakumar
6 Replies

2. Shell Programming and Scripting

Compare 2 text file with 1 column in each file and write mismatch data to 3rd file

Hi, I need to compare 2 text files with around 60000 rows and 1 column. I need to compare these and write the mismatch data to 3rd file. File1 - file2 = file3 wc -l file1.txt 58112 wc -l file2.txt 55260 head -5 file1.txt 101214200123 101214700300 101250030067 101214100500... (10 Replies)
Discussion started by: Divya Nochiyil
10 Replies

3. Shell Programming and Scripting

Shell script (sh file) logic to compare contents of one file with another file and output to file

Shell script logic Hi I have 2 input files like with file 1 content as (file1) "BRGTEST-242" a.txt "BRGTEST-240" a.txt "BRGTEST-219" e.txt File 2 contents as fle(2) "BRGTEST-244" a.txt "BRGTEST-244" b.txt "BRGTEST-231" c.txt "BRGTEST-231" d.txt "BRGTEST-221" e.txt I want to get... (22 Replies)
Discussion started by: pottic
22 Replies
FTPUSERS(5)						     Linux Programmer's Manual						       FTPUSERS(5)

NAME
ftpusers - list of users that may not log in via the FTP daemon DESCRIPTION
The text file ftpusers contains a list of users that may not log in using the File Transfer Protocol (FTP) server daemon. This file is used not merely for system administration purposes but for improving security within a TCP/IP networked environment. It will typically contain a list of the users that either have no business using ftp or have too many privileges to be allowed to log in through the FTP server daemon. Such users usually include root, daemon, bin, uucp, and news. If your FTP server daemon doesn't use ftpusers then it is suggested that you read its documentation to find out how to block access for certain users. Washington University FTP server Daemon (wuftpd) and Professional FTP Daemon (proftpd) are known to make use of ftpusers. Format The format of ftpusers is very simple. There is one account name (or username) per line. Lines starting with a # are ignored. FILES
/etc/ftpusers SEE ALSO
passwd(5), proftpd(8), wuftpd(8) COLOPHON
This page is part of release 3.25 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. Linux 2000-08-27 FTPUSERS(5)
All times are GMT -4. The time now is 03:08 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy