I have a memory map file, out of which I want to parse the content of the buffer. MMAP () achieves success, and I can successfully use fprintf to print the buffer content in the file. However, when I try to access Buffer as an array in my program directly, I get a partition error. Why is this happening? Here's the code: #define PTT_DUMP "/ home / druru / somefile". . Int fd_ptt_dump = Open (PTT_DUMP, O_RDONLY); Structure state struct_ptt_dump; Fstat (fd_ptt_dump, & amp; struct_ptt_dump); Printf ("\ n \ n \ t \ t \ t --- Size of dump =% d ----- \ n \ n", struct_ptt_dump.st_size); Four * membuffer; Four pid_num [100]; Four cycles [100], examples [100], CPI [100]; Int pid_index = 0; Int cycles_index = 0; Int instr_index = 0; Int cpi_index = 0; Int len = (int) struct_ptt_dump.st_size; Int newline_count = 0; Int n = 0; If ((membuffer = mmap (0, struct_ptt_dump.st_size, PROT_READ, MAP_FILE | MAP_PRIVATE, fd_ptt_dump, 0)) == (caddr_t) -1) err_sys ("mm...
Comments
Post a Comment