| | |
Can anyone tell me how to print to alternate files?
Please support our C advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Jan 2005
Posts: 31
Reputation:
Solved Threads: 0
I have a program for a 5-way sort merge. I can get the program to read from the original file of 1,000,000 records and write them to 5 tempoary files (File0 thru File4). Then, I am suppose to close the temp files (Files 0 - 4) and open them as input, and open 5 more temp files (File 5 thru File 9). I cannot get the Files 0 - 4 to print to Files 5 - 9. Here is part of my code, as it is a little long. How do you get the % operator to print to Files 5 - 9? It works fine for Files 0 - 4.
InputCounter = 0;
OutputCounter = 5;
int NumOfPasses = 0;
FileSize = ClumpSize * NumOfFiles;
while (NumOfFiles < 5)
{
while (LoopCount < FileSize)
{
for (j = 0; j < ClumpSize; j++)
{
F[InputCounter%5] >> Number;
ClumpArray[j] = Number;
} // end for
QuickSort(ClumpArray, 0, 999);
for (i = 0; i < ClumpSize; i++)
{
F[InputCounter%5] << setprecision(15);
F[InputCounter%5] << ClumpArray[i] << '\n';
} // end for
InputCounter ++;
OutputCounter++;
} // end while
NumOfFiles ++;
LoopCount++;
} // end while
Thanks for any input you may have.
InputCounter = 0;
OutputCounter = 5;
int NumOfPasses = 0;
FileSize = ClumpSize * NumOfFiles;
while (NumOfFiles < 5)
{
while (LoopCount < FileSize)
{
for (j = 0; j < ClumpSize; j++)
{
F[InputCounter%5] >> Number;
ClumpArray[j] = Number;
} // end for
QuickSort(ClumpArray, 0, 999);
for (i = 0; i < ClumpSize; i++)
{
F[InputCounter%5] << setprecision(15);
F[InputCounter%5] << ClumpArray[i] << '\n';
} // end for
InputCounter ++;
OutputCounter++;
} // end while
NumOfFiles ++;
LoopCount++;
} // end while
Thanks for any input you may have.
![]() |
Similar Threads
- Print different format files using java API (Java)
- Print PDF files using VB 2005 (VB.NET)
- CSS Style sheets (HTML and CSS)
- Print to XPS Printer from VB6 (Visual Basic 4 / 5 / 6)
- print from a .txt file (C++)
- Silent printing of pdf files to a named printer... (Visual Basic 4 / 5 / 6)
- Large Print jobs and Windows XP Pro (Windows NT / 2000 / XP)
- How can we print an MS Word document from Java (Java)
Other Threads in the C Forum
- Previous Thread: Recursive functions???
- Next Thread: Exporting data into Excel
| Thread Tools | Search this Thread |
Tag cloud for C
#include adobe ansi array arrays asterisks binarysearch calculate centimeter changingto char convert copyimagefile cprogramme creafecopyofanytypeoffileinc database directory dynamic fflush file fork forloop framework getlasterror givemetehcodez grade graphics gtkgcurlcompiling hacking hardware histogram homework inches include incrementoperators input iso kernel km lazy linked linkedlist linux linuxsegmentationfault list lists locate logical_drives looping loopinsideloop. lowest match matrix microsoft motherboard multi mysql number opendocumentformat opensource owf pattern pdf performance pointer posix problem probleminc process program programming radix recursion recv research reversing scanf scripting segmentationfault sequential shape socket socketprograming spoonfeeding standard string strings structures student systemcall testing threads turboc unix user variable voidmain() wab windows.h windowsapi





