the problem with ifstream(help!!!!!!!)

this the header:

#ifndef _BIGINTEGER_H_
#define _BIGINTEGER_H_

using namespace std;

#define PLUS true
#define MINUS false

/* struct definition for bigInteger & each digit in singly linked list */

typedef struct digitNode *digitPointer;

struct digitNode{
unsigned short int digit;
digitPointer next;
};

struct bigInteger {
bool sign; // the sign of the integer
digitPointer head; // pointer to the linked list
};
##############################################################
the function:
bigInteger read_bigInteger(const char* fileName)
{
ifstream in(fileName);
char ch;
bigInteger a;
digitPointer p=a.head;
while(in.get(ch))
{
p=new digitNode;
p->digit=char2int(ch); //the function char2int is no problem.
p=p->next;
}
return a;
}
###################################
the main:
int main(int argc, char* argv[])
{
streambuf* buf;
ofstream of;
if (argc > 1) {
of.open(argv[1]);
buf = of.rdbuf();
} else {
buf = std::cout.rdbuf();
}
ostream out(buf);

bigInteger a = read_bigInteger("input1.txt");
out<< "a=";
print_bigInteger(a, out);
out<< endl;
print_list(a, out);
if (isPositive(a)) out << "a is a positive integer.\n";

.............
the problem is that:after complie the code,why i cant nothing even i cant see the "a=",i guess the problem maybe in the" read_bigInteger("input1.txt")"
but i stil dont know the problem in this function.

please help!!!!!!!!!!!
Last edited on
When you post code, it helps to use code tags, to make it easier to understand.

Then people might be more willing to take the time to read your code and help out.
Topic archived. No new replies allowed.