LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-14-2005, 06:59 AM   #1
bahadur
Member
 
Registered: Apr 2004
Distribution: Linux Red Hat
Posts: 141

Rep: Reputation: 15
Need PERL example sysread and syswrite


hi,

i am trying to write a small FTP server.

now after all the normal authentication here is what i want to do.

check whether the selected file is there or not?

if it is there start tranfering it in binary mode.

now there is one problem i have doing this.

the sysread function has the following arguments.

sysread(FILEHANDLE, $scalar, $LENGTH)

Attempts to read LENGTH bytes of data into variable SCALAR from the specified FILEHANDLE, using the system call read().

now the thing is that how do i know what length a file is. cause every file will have a different length so i have to know the length of the file before i transfer it.

so how do i know what length a file is. REMEMBER THE FILE HAS TO BE TRANSFERED IN BINARY that is the mode of the handle will be changed to binary using binmode function.


secondly can any one tell me that if i syswrite() a file to socket how can i read it back at the client end using sysread of syswrite.

plz explain with little code.
 
Old 08-03-2005, 10:00 PM   #2
Tomasfuego
Member
 
Registered: Nov 2002
Location: USA
Distribution: Lenny at work
Posts: 168

Rep: Reputation: 30
http://perldoc.perl.org/functions/stat.html

does this function help?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with perl module for w3c validator to work on my local Apache+PHP+perl instal tbamt Linux - Software 0 12-16-2004 05:37 PM
Hiding code in PERL, perl gui question randomx Programming 1 06-26-2004 03:22 PM
cgi perl : I cant get perl to append my html file... the_y_man Programming 3 03-22-2004 05:07 AM
perl(Cwd) perl(File::Basename) perl(File::Copy) perl(strict)....What are those? Baldorg Linux - Software 1 11-09-2003 08:09 PM
chrooting apache v2 (php, ssl, perl support) ; perl configuration markus1982 Linux - Security 3 01-26-2003 06:15 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:17 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration