Read and write textfile using pointer

Nevermind fixed it
Last edited on
The file input and output works for for me, there are just a couple things that one needs to be aware of. Line 23 should be void createCards(cards *ptr, cards *wastePtr, char *filePtr);. Also, the file that the user inputs must have at least 72 suites and 72 ranks, or you'll get garbage.

I don't know what "klondike style" is (I'm not a card player, if that would help.) so I don't know if the program behaved correctly.

previousGame.txt (the input was random):
Spade 3 Diamond 5 Heart 11 Diamond 3 Club 2 Club 11 Spade 5 
Heart 3 Heart 5 Heart 3 Club 6 Heart 11 Diamond 3 
Spade 1 Spade 6 Heart 1 Club 4 Diamond 1 
Heart 3 Spade 13 Heart 11 Club 6 
Spade 10 Heart 1 Heart 1 
Heart 2 Heart 7 
Diamond 8 




If the result is incorrect, I would be very suspicious of the writeCards function.

Edit:
Oh, createCards does it too. That is they increment ptr but don't do anything with it half the time.

Edit 2:
Nice, I did it again =/ .
Last edited on
Topic archived. No new replies allowed.