Mail Archives: djgpp/1999/09/12/12:08:24
From: | tchuma AT sympac DOT com DOT au (Tim Chmielewski)
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Printing Problems
|
Date: | 12 Sep 1999 14:10:34 GMT
|
Organization: | Freevision
|
Lines: | 53
|
Message-ID: | <7rgc8q$e1c$2@perki.connect.com.au>
|
NNTP-Posting-Host: | mdm-3-52.sympac.com.au
|
Mime-Version: | 1.0
|
X-Trace: | perki.connect.com.au 937145434 14380 203.30.68.131 (12 Sep 1999 14:10:34 GMT)
|
X-Complaints-To: | abuse AT connect DOT com DOT au
|
NNTP-Posting-Date: | 12 Sep 1999 14:10:34 GMT
|
X-Newsreader: | WinVN 0.99.9 (Released Version) (x86 32bit)
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
I'm having a problem with printing out the results of this program to
the printer.
It prints :
Tattslotto number generator.
(garbage)
#include <iostream.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
/* Tattslotto number generator
* By : Tim Chmielewski
* Date : 13/09/1999
*/
main()
{
FILE *fp;
int tempint = 0;
char holdint[2] = "";
if((fp = fopen("prn","w"))==NULL)
{
puts("Cannot access the printer");
exit(1);
}
fputs("Tattslotto number generator.\n", fp);
srand(time(NULL));
for (int i = 1; i <= 4; i++) {
for (int j = 1; j <= 6; j++) {
tempint = 1 + (rand() % 45);
memset(holdint, tempint, 2);
strcat(holdint, " ");
fputs(holdint ,fp);
}
fputs("\n", fp);
}
fclose(fp);
return 0;
}
Thanks.
- Raw text -