Hello all,
I am in need of some assistence. So if anyone could help that would make my day;).
This is a piece of my code
for( int i = 0; i <= 13; i++ )
{
cout << "SLOT : " << slotNumber;
fprintf( HashTable, "\t%i slot : " , slotNumber );
for( n = Head; n != NULL; n = n->Next )
{
if ( hashfunction(n->data) == slotNumber )
{
cout << " " << n->data << " , ";
fprintf( HashTable, "\t%s " , n->data);
As you can see , I'm trying to output my n->data to a (text)file named hashtable
unfortunately all I'm getting is
slot 0:
slot 1: (null)
slot 2:
slot 3 (null) (null)
And stuff like that. I want it to output the real data stored in my hashelement. The cout works fine so I know there is data there. Is there anyone with a solution in fprintf or perhaps another function that could write my actual data correct to my (text) file.
ps. It's necessary for me to output the data as I've written above, so that my text output could resemble something like
slot 0: element1 , element2
slot 1: element5 ,
slot 2:
slot 3: element6, element8
If anyone has an answer that would be super.
thanks