Mail Archives: djgpp/1998/02/19/21:19:37
From: | garbage DOT collection AT dial DOT pipex DOT com (Richard Ward)
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Help
|
Date: | Thu, 19 Feb 1998 19:27:32 GMT
|
Organization: | UUNet UK server (post doesn't reflect views of UUNet UK)
|
Lines: | 88
|
Message-ID: | <34ec84f8.2393449@news.dial.pipex.com>
|
NNTP-Posting-Host: | ag102.du.pipex.com
|
Mime-Version: | 1.0
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Can anyone please help me with the below code. While I have not done
any C programming for the past 18 months I thought I would start again
by porting over one of my old programs, my NVQ level 2 programming
project. Below is just a small part but for some reason it just does
not work.
The key presses and exit routines wouk ok, (i have removed the some of
the cases to make the below smaller), but the display routines do not
work. I have tested the print_at routine on its own and it works
fine.
At this rate I think I will not continue programming as if this fools
me god help me in the future. All I can think of is that its
something to do with the compiler not compiling the instructions in
the right order, something with I have problems with Xenix 1987
version.
Richard
#include <stdio.h> // Include Libraries
#include <stdlib.h>
#include <string.h>
#include <conio.h>
#include <stdarg.h>
void print_at(int, int, char *format, ...);
void disp_screen(void); // Declare functions
void input(char *,int);
main(void)
{
char result;
disp_screen(); // Display screen
do
{
print_at(20,1,"Enter Option : ");
result=getch();
if (result>='1' && result<='5')
{
switch(result)
{
case '1' :
break;
}
disp_screen();
}
else
{
if (result!='x') // Invalid Option
{
print_at(20,1,"Invalid Option ");
print_at(20,1," ");
}
}
} while(result!='x'); // Exit on 'x'
clrscr();
}
void disp_screen(void)
{
clrscr();
print_at(1,1,"Main Menu");
print_at(4,20, "1. Add / Display Client Details");
print_at(6,20, "2. Add / Display Solictior Details");
print_at(8,20, "3. List Solicitors Clients");
print_at(10,20,"4. List Clients Solitors");
print_at(12,20,"5. Enter Time Sheets");
print_at(14,20,"X. Exit");
print_at(19,1,"-----------------------------------------");
printf("----------------------------------------");
}
void print_at(int y, int x, char *format, ...)
{
va_list ptr;
gotoxy(x,y);
va_start(ptr, format);
vprintf(format, ptr)
va_end(ptr);
}
============================
rich DOT ward AT bigfoot DOT com
ICQ : 5267472
- Raw text -