2004.10.25 12:27 "[Tiff] read 5 bands geotiff image", by Zheng Hu

2004.10.25 12:27 "[Tiff] read 5 bands geotiff image", by Zheng Hu

Hi,

I write a code to read my 5 bands geotiff image

                unsigned char *buf;
                float *test = &buf;

                buf = _TIFFmalloc(scansize);
                for (line = 0; line < 5; line++)   //5 pixel
                {
                        int i;
                        const char *sep = "";
                        //float *test = &buf;
                        //TIFFReadScanline(tif, test, line, 0);
                        fprintf(stdout, "%d:", line);
                                for (i = 0; i < 50; i++)   // 50 length
                                {
                                                int j;
                                                TIFFReadScanline(tif, test, i, line);
                                                fprintf(stdout, "%s", sep);
                                for (j = 0; j < 50;     j++)  // 50 width
                                {
                                        fprintf(stdout, " %f", test[i * 50+ j]);
                                }
                                sep = ",";

                        }
                        fprintf(stdout, "\n");
                }

When I run this code, I find variable i and line is overflow...... How can I do????Where is wrong??