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!