Jump to content



Photo
- - - - -

Bug in Memzones!?!


  • Please log in to reply
No replies to this topic

#1 huhn_m

huhn_m

    Casio Maniac

  • [Legends]
  • PipPipPipPipPipPipPipPip
  • 1957 posts
  • Gender:Male
  • Location:Germany / Dresden
  • Interests:Assembler(!!!)
    Computers and Programming
    Operating Systems
    Programmable Calculators
    Maths and everything arround it

  • Calculators:
    FX-82SX / AFX 2.0+ (ROM 1.03) / FX 1.0+ (ROM 1.03)

Posted 01 January 2003 - 05:27 PM

As I've written in another topic im currently working on a program.
Now I've expirienced an annoying bug wether in my program or
in the memzones library of 2072.

Because 2072 has not yet answered I'll ask you if you experienced the
same problem: If you write a single char and read it again I get another
char back. Maybe the mistake is in my code (I'm a beginner in C programming
and don't know much about pointers etc.)

here is a sample code that reproduces the result:

#include "memzones.h"
#include "stdio.h"
#include "conio.h"
struct memory_zone bf;

void main(void)
{
       char test = 'A';
       char ret;
       unsigned char filename[9] = "TEST_X  ";
       unsigned int filesize=100;
       long filesize2 = 100;
       if (create_mem_zone(1,filename,filesize,CREATE_ZONE)==0)
       {
               if (search_mem_zone(1,filename,&bf) != filesize2)
               {
                       printf("%ld\nERROR!",search_mem_zone(1,filename,&bf));
               }
               else
               {
                       write_mem_zone(&bf,&test,1,1);
                       read_mem_zone(&bf,&ret,1,1);
                       printf("%c|%c\n",ret,test);
                       if (ret == 'A')
                               printf("FOUND!%c|%c",ret,test);
               }
               getch();
       }
}

It should print "FOUND " in a second line and then
the text 'A|A', but it doesn't!

It just prints the first line and there the char read is a small one.
Can anyone here help me???


Thanx!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users