FILE I/O & SLOW WINDOWS

MITCHELL L GRAVES VC008329%NDSUVM1.BITNET at cunyvm.cuny.EDU
Mon Feb 8 03:51:20 AEST 1988


 I have been using Turbo C for anly a few months now and I'm having a couple
of problems with a program I'm writing.

The first problem is that when I save a variable to a file I am having to also
print a 'n'to get to the next line to save my next variable. Problem is, is
when I gets the password variable from the file and do a comparison with the
file variable and the password I type, in it doesn't compare. Here's an example
of how the variables are saved to a file:

        SAVE TO FILE                         RETRIEVE FROM FILE
    file = fopen("main","w");           file = fopen("main","r");
    fputs(title,file);                  fgets(title,sizeof(title),file);
    fprintf(file,'n');                 fprintf(file,'n');
    fputs(password,file);               fgets(password,sizeof(password),file);
    fprintf(file,'n');                 fprintf(file,'n');
    fputs(selpass,file);                fgets(selpass,sizeof(selpass),file);
    fclose(file);                       fclose(file);

Now when I do a string compare it doesn't compare.  Then I printed the password
and used a set of bars (to test) on each side of the string like this:

       printf("Password is: |%s|",&password);

This is what it looks like when I print password:

Password is: |ORANGE
|

It puts the bar on the next line.  Is there anyway to remedy this or even a
better way of doing this.  I sure could use some experienced suggestions.

Problem Two:

I am drawing windows on the screen when  prompting for passwords & things
of that nature.  I can watch the window being drawn (Very Sloooww!).  I heard
there is a way to write the screen to a buffer (or something like that) and
later call it up so I don't have to watch the window being slowly drawn each
time.  Can anyone help me out?

                     A very greatful THANKS in advance!

Mitchell L. Graves (VC008329%NDSUVM1.BITNET at WISCVM.WISC.EDU)



More information about the Comp.lang.c mailing list