Click here to Skip to main content
14,983,071 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
Hi all,

i have scenario like below mentioned.

i want to generate 1000 multiple files in a directory.
after generating, for each generated file i have to write data of 20 pdf files into that file individually.
in a columns we have 1001 rows,we read from row and create/generate as files and we write the data asssociating to that row(20 pdf files)

how to generate the multiple files using File or iostream/ostream?
[no name] 17-Jul-12 11:57am
ofstream out("c:\\file_for_really_bad_idea.txt"); will create an empty file. Just repeat 1000 times with the filenames that you want.
Albert Holguin 17-Jul-12 16:23pm
I love your file title! +5! :D
[no name] 17-Jul-12 16:54pm
Thanks... sometimes the stars align just right... :-)
Albert Holguin 17-Jul-12 16:57pm
I didn't notice it at first but when I looked a second time I couldn't stop laughing... People probably think I'm crazy at work...
Sergey Alexandrovich Kryukov 17-Jul-12 12:27pm
Why all that weird activity. If you want so create so many files with PDF content, is suggests you are doing something wrong. If you want to be taken seriously, explain your ultimate goals. Who would want to waste time for advice if the whole idea could be wrong?
[no name] 18-Jul-12 4:22am
SA has said it all. For example what is the point of these files that contain 20 pdf's? Why not 2 or 200?
You need to think this problem out clearly and then explain it all.
It seems you are trying to create some kind of database based on pdfs. If so this is not how to do it.
Albert Holguin 19-Jul-12 10:55am
In addition to everyone's comments, keep in mind PDF's are stored as binary (versus text), so you can't just append one file to another, you have to be able to interpret the files so that PDF readers can make sense of what you put together.
[no name] 19-Jul-12 20:50pm
Exactly where I was going. Adobe publishes an API but this is not trivial.

1 solution

I gave you links to the file handling routines in my answer to your earlier question[^], but you still have not explained which part of this you do not understand.
Generating multiple files is merely a matter of creating loops, and repeating a sequence of create, read/write, close operations.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900