LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 02-02-2010, 07:39 AM   #1
immadisetty
LQ Newbie
 
Registered: Nov 2009
Posts: 10

Rep: Reputation: 0
Problem in File Handling


hi friends,
I have a file at one place .....and i need to copy that file into another directory with same name ,but not the whole file at a time...
i need to copy it block by block(say block may be of some particular bytes)
Can anyone give some idea regarding this.....


Thanks in advance
 
Old 02-02-2010, 07:44 AM   #2
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
You could use the "dd" program to cut out slices of the file. You can then append the output of dd to the destination file.

You can use the slice program to produce slices of a file. They can be joined with "cat".
 
Old 02-02-2010, 11:16 PM   #3
immadisetty
LQ Newbie
 
Registered: Nov 2009
Posts: 10

Original Poster
Rep: Reputation: 0
Thank you for reply......

BUt, Sorry, i forget to say you that ... i was trying to that in Server-Client based program(udp based....
I need to acknowledge each block of data when received.....
Say
Client ------------------------------------------ Server
WriteRequest( with filename )
-------------------------------------------------->
acknowledge Request Obtained
<---------------------------------------------------
Need to Send Data(of Certain Block)
--------------------------------------------------->
Ack of Block od Data Sent
<-----------------------------------------------------


Like that i need to prooceed........
Any suggetions regarding this.....
 
Old 02-03-2010, 12:32 AM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Which programming language?
 
Old 02-03-2010, 01:06 AM   #5
immadisetty
LQ Newbie
 
Registered: Nov 2009
Posts: 10

Original Poster
Rep: Reputation: 0
im doing it using "C" language

Last edited by immadisetty; 02-03-2010 at 01:07 AM.
 
Old 02-03-2010, 01:51 AM   #6
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Open the file:

http://linux.die.net/man/3/fopen

loop reading in blocks until EOF:

http://linux.die.net/man/2/read

close the file:

http://linux.die.net/man/3/fclose
 
1 members found this post helpful.
  


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
File Handling in C++ jmandumpal Programming 6 09-04-2008 09:18 PM
A file handling problem. ASRaj Programming 3 03-17-2008 06:09 AM
Problem in file handling viveksnv Programming 2 02-28-2008 07:09 AM
File Handling In C/C++ vikasumit Programming 5 06-18-2006 11:43 PM
Screem file handling silmaril8n Linux - Software 1 06-14-2004 03:44 PM

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

All times are GMT -5. The time now is 12:58 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