Hi.Would you mind helping me about one question about samba ?

Enviroment:
There is a directory called c:\xpdoc\test(NTFS) on Windows 2000.
There is a file called test under the dir .
Use smbmount to mount the directory to /mnt/test on Linux Red hat7.2(Kernel 2.4.7-10).
Samba's version is 2.2.1a-4.

//write.cpp
#include <string.h>
#include <stdio.h>

int main(int argc, char* argv[])
{
 FILE* fp ;
 fp = fopen("c:\\xpdoc\\test\\test" , "wb+") ;
 char szBuf[255] ;
 if(fp == NULL)
 {
  printf("Failed to open file!\n") ;
  return 0 ;
 }

 for(int i = 1 ; i <= 100000; i++)
 { 
  int j ;
  
  fseek(fp , 0 , SEEK_SET) ;
  memset(szBuf , 0 , 255) ;
  sprintf(szBuf , "%d*" , i) ;

  j = fwrite(szBuf , sizeof(char) , 2 , fp) ;
  printf("%s:%d:%d\n" , szBuf , strlen(szBuf) , j) ;
  
  getchar();
 }

 fclose(fp) ;
}
the file is compiled to executble file(writer) and run on the windows.

//Read.cpp
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <fcntl.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>


int main(int argc, char* argv[])
{
 int  fh ;
 char szBuf[255] ;
 
 for(;;)
 {
  fh = open("/mnt/test/test" , O_RDONLY) ;
  if(fh == -1)
  {
   printf("Failed to open file!\n") ;
   return 0 ;
  }
  
  memset(szBuf , 0 , 255) ;
 
  read(fh , szBuf , 10) ;
  printf("%s\n" , szBuf) ;
  close(fh);
  sleep(1) ;
 }

 return 0 ;
}
the file is compiled to executable file(reader) and run on redhat linux.

Question:
writer has written some data in the test file,
but reader couldn't read the new data.Why.

Remarks:
writer keeps writing data into test file and doesn't close the file.
What can i do to get the new data in test file?

Thanks

kingland
[EMAIL PROTECTED]
-- 
To unsubscribe from this list go to the following URL and read the
instructions:  http://lists.samba.org/mailman/listinfo/samba

Reply via email to