|
||
|
GP Mailing List
ATXGPSIG List
|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Game Programming: What's wrong with my perfectly written code? plz check someone
------------------------------------------------------------
GameProgrammer.Com: Game Programming: What's wrong with my
perfectly written code? plz check someone
------------------------------------------------------------
By Tapani on Saturday, June 17, 2000 - 10:07 am:
Everytime I work on some project and the code seems working
and allright and after the errors fixed from the compiler
the program is a total disaster.
(this code's purpose is to scan text line by line max 80
chars at a time and after a line ask if the use want's to
quit, none seem to work)
(some strange symbols got into the message, well hope you'll
understand the meaning)
#include
#include
#include
#include
void scan(char pointera[50][80]);
void print(char pointerb[50][80]);
void main(void)
{
char line[50][80];
clrscr();
printf("Ascii saver by Tapani Niku");
getch();
clrscr();
scan(line);
}
void scan(char pointera[50][80])
{
char helpstrn[80],quitting[4],qcheck[4];
int counter;
strcpy(qcheck,"quit");
for(counter =0;counter<50;counter++)
{
scanf("%s^#92;n",&helpstrn);
strcpy(pointera[counter],helpstrn);
printf("If you want to quit writing now, type
^#92;"quit^#92;" + enter^#92;notherwise press just enter:");
scanf("%s^#92;n",&quitting);
if(strcmp(quitting,qcheck)==0)
print(pointera);
}
print(pointera);
}
void print(char pointerb[50][80])
{
int counter;
FILE *datafile;
datafile = fopen("text.txt","w");
if (datafile == NULL)
{
printf("^#92;n^#92;"text.txt^#92;"-file is
missing.^#92;n");
printf("Copyright(c) Tapani Niku 2000");
exit(1);
}
for(counter=0;counter<50;counter++)
{
fputs(pointerb[counter],datafile);
}
printf("^#92;n^#92;nText written to
^#92;"text.txt^#92;"-file^#92;n");
printf("^#92;nCopyright(c) Tapani Niku 2000^#92;n");
exit(1);
}
------------------------------------------------------------
DO NOT REPLY TO THIS MESSAGE! It is an automatic e-mail
notification message from the discussion board indicating
that a new message was posted. If you do not wish to
receive further e-mail notification messages from this
discussion board, edit your user or moderator profile to
turn off the e-mail notification option.
Use this link to go directly to the discussion:
http://gameprogrammer.com/cgi-bin/comm/gameprogrammer/discus/show.pl?6/53
|
|