Computer Science Canada

Generating 128 files with different names in one program.

Author:  UWO [ Fri Oct 28, 2005 8:35 am ]
Post subject:  Generating 128 files with different names in one program.

Hi all,

I need to generate 128 different files. I have a C program that i have designed that generates one file at a time. I have one option that i compile my program 128 times and while compiling i give different names or i could write a small C program or a script that would deal with the situation. The problem i get when i want the file to have 128 different names. The file saves strings only while saving the file, it does not read integers as i tried to save the file with in an integer loop. What step should i take in order to save the file with different names.

Regaards,

UWO.

Author:  Tony [ Fri Oct 28, 2005 8:56 am ]
Post subject: 

you could use the ASCII equivelent of the integer. Just make sure you stay in the alphabetic boundary Wink

Author:  Mazer [ Fri Oct 28, 2005 3:54 pm ]
Post subject: 

Why not convert an integer to a string?

Author:  MysticVegeta [ Mon Oct 31, 2005 6:35 pm ]
Post subject: 

what is the command to do that?

Author:  wtd [ Mon Oct 31, 2005 7:31 pm ]
Post subject: 

c++:
#include <sstream>
#include <iostream>
#include <string>

int main()
{
   int number(42);
   std::string output;
   std::stringstream ss;

   ss << number;

   ss >> output;

   std::cout << output << std::endl;
}


: