Hey Please!!!! SCANF IN VGA!!!!!

Search this archive.

From: Nicolas Raitman (new_world@radar.com.ar)
Date: Thu 31 Aug 2000 - 04:47:45 IDT


I know that you are very busy, but please help me!!! If not I will loose a
work that i really need!!!!!

Thanks!!!!!

Look at the following program:

#include <stdio.h>
#include <stdlib.h>
#include <vgakeyboard.h>
#include <math.h>
#include <vgagl.h>
#include <vga.h>
#include <string.h>
#include <unistd.h>


#define TEXT 0

float m, b;

GraphicsContext *physical_screen;
GraphicsContext *virtual_screen;



int main (void)

{


extern unsigned char *gl_font8x8;

vga_disabledriverreport();
vga_init();
vga_setmode(12);
gl_setcontextvga(12);

physical_screen = gl_allocatecontext();
gl_getcontext(physical_screen);
gl_setcontextvgavirtual(12);
virtual_screen = gl_allocatecontext();
gl_getcontext(virtual_screen);
gl_setcontext(virtual_screen);
gl_setfont(8,8,gl_font8x8);
gl_setwritemode(FONT_COMPRESSED + WRITEMODE_MASKED);
gl_clearscreen(0);

gl_setcontext(physical_screen);
gl_clearscreen(0);

gl_printf(350,100,"Valor de M = ");
gl_setcontext(physical_screen);

/* now here i want to get the value of m. As you have seen above is a float,
so i cannot do that with chars and then convert it to flot because it may
have a comma and im not sure on wheter the conversion function will
recognize that.

Besides, it might be that im making a mistake before. Please loot at the
code  and tell me where to change it! TRY TO TEST IT! I MUST HVAE THIS READY
FOR THE WEEKEND AND I CANT FINISH THE PROGRAM JUST BECAUSE I CANNOT GET THE
FLOATING POINT VARIABLE AND ADD IT TO ANOTHER!!!
*/


gl_printf(350,200,"B = ");
gl_copyscreen(physical_screen);

gl_printf(400,400,"M + B = %f\n", m + b);
gl_printf(350,400,"Press a key...");
gl_copyscreen(physical_screen);
getchar();
gl_clearscreen(0);
vga_setmode(TEXT);

exit(EXIT_SUCCESS);

}


Of course, the program is much more complex and i will not add the numbers,
it will be a complex mathematical equation, however, the idea is the same.


This archive was generated by hypermail 2.1.4 : Wed 21 Jan 2004 - 22:10:23 IST