M
Mr. Mxyztplk
(supposing file fp has been opened in binary mode, and m = n/p)
Just wondering if this approach
for (i = 0; i < p; i++) {
for (j = 0; j < q; j++) {
fseek(fp, i, SEEK_SET);
for (k = 0; k < m; k++) {
fread(&ch, sizeof(char), 1, fp);
fseek(fcipher, p - 1, SEEK_CUR);
/* do whatever */
}
}
}
actually does run more efficiently (less moving back and forth between
locations??) than the following
for (i = 0; i < p; i++) {
for (j = 0; j < q; j++) {
for (k = 0; k < n - i + 1; k += p) {
fseek(fp, k + i, SEEK_SET);
fread(&ch, sizeof(char), 1, fp);
/* do whatever */
}
}
}
?
For my purposes it has not made any difference one way or the other. So
far, that is.
Just wondering if this approach
for (i = 0; i < p; i++) {
for (j = 0; j < q; j++) {
fseek(fp, i, SEEK_SET);
for (k = 0; k < m; k++) {
fread(&ch, sizeof(char), 1, fp);
fseek(fcipher, p - 1, SEEK_CUR);
/* do whatever */
}
}
}
actually does run more efficiently (less moving back and forth between
locations??) than the following
for (i = 0; i < p; i++) {
for (j = 0; j < q; j++) {
for (k = 0; k < n - i + 1; k += p) {
fseek(fp, k + i, SEEK_SET);
fread(&ch, sizeof(char), 1, fp);
/* do whatever */
}
}
}
?
For my purposes it has not made any difference one way or the other. So
far, that is.