GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 06-May-2009, 22:14
aimann aimann is offline
New Member
 
Join Date: May 2009
Posts: 1
aimann is on a distinguished road

Partition a file on user input


hi all,
I need C++ program that read data from text file and partition it into specific number ,specified by the user.for example the user run the program,the program first will ask the user how many partition do you want ?after obtain the number of partitions ,the program will read the text file and show the partitions on the console and and the content of each partition.
thank you in advance
aiman
  #2  
Old 07-May-2009, 01:06
WaltP's Avatar
WaltP WaltP is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Midwest US
Posts: 3,335
WaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to all

Re: help needed!


Quote:
Originally Posted by aimann
hi all,
I need C++ program that read data from text file and partition it into specific number ,specified by the user.for example the user run the program,the program first will ask the user how many partition do you want ?after obtain the number of partitions ,the program will read the text file and show the partitions on the console and and the content of each partition.
thank you in advance
aiman
Try reading the Guidelines as requested.
__________________

During the election they said Obama could only be elected when pigs fly. Well, we currently have an epidemic of Swine Flu. Coincidence?
  #3  
Old 07-May-2009, 08:10
fakepoo fakepoo is offline
Regular Member
 
Join Date: Oct 2007
Posts: 713
fakepoo is a jewel in the roughfakepoo is a jewel in the roughfakepoo is a jewel in the rough

Re: help needed!


Quote:
Originally Posted by aimann
hi all,
I need C++ program that read data from text file and partition it into specific number ,specified by the user.for example the user run the program,the program first will ask the user how many partition do you want ?after obtain the number of partitions ,the program will read the text file and show the partitions on the console and and the content of each partition.
thank you in advance
aiman
Let's see if I understand you correctly. If I enter the number 4 into your program, it will divide the text in the file into 4 equal parts to display separately? If that is the case, here is how I might go about it:

1) Open the file and count the number of characters.

2) Get the partition number from the user.

3) Calculate the partition size based on the character count and the partition number.

4) Reset the file to the beginning.

5) For each partition, read the correct number of characters from the file and print them to the screen.
 
 

Recent GIDBlogAccepted for Ph.D. program by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Program Needed: Perfect Number Program in C language koool_kid C Programming Language 13 22-Aug-2009 10:42
C++ games programmer needed (London, freelance contract) Nickdammit Computer Programming Advertisements & Offers 2 22-Dec-2008 15:01
help needed !!! haruka C Programming Language 3 13-Nov-2007 14:24
Free 1st month / Free setup / No credit card needed...Plans start at 4.95 LarryIsaac Web Hosting Advertisements & Offers 0 11-Oct-2003 15:03

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 02:36.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.