Print a range of memory values into a file

Print a range of memory values into a file

Post by saffeyeldi » Mon, 05 Sep 2005 19:53:14


i want to print a range of memory values into a file. i have used the
following sequence of commands in the HIwave emulator

define i = 0

while i<1024
fprintf(out.txt,"%c",buff[i])
define i = i + 1
endwhile

the main problem that it's so slow

can't i instruct the fprinf command to print it as a string like this

fprintf(out.txt,"%s",buff)
 
 
 

Print a range of memory values into a file

Post by rTrenad » Thu, 08 Sep 2005 04:31:29

Try using fwrite() instead (assuming you are not using any stream
formatting).

Your code becomes:

fwrite (buff, 1024, 1, fp);

Just make sure your out.txt has enough room to accomodate large buffers
(I believe you can achieve that by increasing the stack size in
hiwave).