Author

Topic: Need guidance from C++ programmers (Read 741 times)

sr. member
Activity: 504
Merit: 250
August 25, 2014, 08:56:48 AM
#3

why don't you just throw whatever the result is into a temporary variable?

so the output variable would be C, then each time the loop runs have something increment C so you can have a count, so you can have it output like C1 = blah129832392 C2= b1293029301923 C3= 023940349fj2

are you talking about like that?

if this is all just outputting to a console, i would recommend you output into a database and preferably not a text document but you can.

I figured it out using stringstream. Will post back with updates tomorrow.
hero member
Activity: 700
Merit: 500
August 25, 2014, 08:47:25 AM
#2
This is my code:
Code:
#include
#include
#include "sha256.h"
#include
#include
using namespace std;

int main()
{
   int a = 0;
   int b = 1;
   int h = 0;
   string j = "80";

   do
   {
        h++;
        cout << j << hex << setfill('0') << setw(64) << h << endl;

   }
   while ( a < b );
   return 0;
   }
The code does this:
1. It increments the variable "h" by 1
2. Adds the 000000000000000000 padding that I need
3. converts it to hex
4. appends the 0x80 (See here: https://en.bitcoin.it/wiki/Wallet_import_format)

How do I transfer the output to another variable instead of just using cout?

why don't you just throw whatever the result is into a temporary variable?

so the output variable would be C, then each time the loop runs have something increment C so you can have a count, so you can have it output like C1 = blah129832392 C2= b1293029301923 C3= 023940349fj2

are you talking about like that?

if this is all just outputting to a console, i would recommend you output into a database and preferably not a text document but you can.
sr. member
Activity: 504
Merit: 250
August 25, 2014, 07:14:34 AM
#1
This is my code:
Code:
#include
#include
#include "sha256.h"
#include
#include
using namespace std;

int main()
{
   int a = 0;
   int b = 1;
   int h = 0;
   string j = "80";

   do
   {
        h++;
        cout << j << hex << setfill('0') << setw(64) << h << endl;

   }
   while ( a < b );
   return 0;
   }
The code does this:
1. It increments the variable "h" by 1
2. Adds the 000000000000000000 padding that I need
3. converts it to hex
4. appends the 0x80 (See here: https://en.bitcoin.it/wiki/Wallet_import_format)

How do I transfer the output to another variable instead of just using cout?
Jump to: