The file is at eof after the write.  Do a FileSeek(begin) before read.
BTW, casting to void* does nothing.
venkatesh wrote:
> 
> Hi
>         I want to use File Streaming API in my application. I have
> tried with FileWrite( ) and FileRead( ) calls. I am able to write some
> bytes into a file. But reading that file always returns zero objects.
> I didn't got any errors also. Can anybody suggest some way to do this.
> 
> The code follows:
> 
> int file(void)
> {
>     FileHand tmpFile = NULL;
>   Int32 written, read;
>   char write_buffer[4] = "abcd";
>   char read_buffer[4] = "    ";
> tmpFile = FileOpen (0, "ptt1.txt", 0, 0, fileModeReadWrite, NULL);
>   if (tmpFile == NULL)
>   {
>    printf("Error opening file");
>   }
> 
>   written = FileWrite (tmpFile, (void *)write_buffer, 1, 4, &err);
>   printf("Bytes Written = %d.\n",(int)written);
> 
>   read = FileRead (tmpFile, (void *)read_buffer, 1, 4, &err);
>   printf("Bytes Read = %d.\n",(int)read);
> err = FileClose(tiffFile);
> return 0;
> }
> debugging returns err = 0
> 
> Thanks in advance
> 
> venkatesh
> 
> --
> For information on using the Palm Developer Forums, or to unsubscribe, please see 
>http://www.palmos.com/dev/tech/support/forums/

-- 
Raoul    __O 
       _-\<,_
      (_)/ (_)

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to