As a part of the project I'm working on multiple .ps files need be generated. Note the following: This means if 0 is passed as a parameter, file with filename forGallery0.ps should be formed(in pics folder). However, I got the following error: Any suggestions on how to avoid this, or other ideas to print files with different filenames are very welcome. I understand that std:fstream saveFile("something.ps"); would work, but I want this to be dynamic.