![]() |
China DOS Union-- Unite DOS · Advance DOS · Grow DOS --Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum |
| Guest | Log in | Register | Members | Search | China DOS Union |
|
中国DOS联盟论坛 The time now is 2026-10-31 06:06 |
47,815 topics / 349,930 posts / today 0 new / 48,290 members |
| DOS开发编程 & 发展交流 (开发室) » Reading and writing large dbf files in C |
| Printable Version 1,872 / 4 |
| Floor1 liyangwyh | Posted 2010-01-21 11:11 |
| 初级用户 Posts 24 Credits 72 | |
|
I'm reading records in a dbf line by line in C under DOS, and it freezes when the data file gets large.
fseek(fp, headlength, 0); /* Position the file pointer to the start of the first record */ for (recno = 1; recno <= recnumber; recno++) { fgets(str, reclength + 1, fp); printf("%u, %s\n", recno, str); } Does anyone have any good methods to solve this? |
|
| Floor2 mmxx0212 | Posted 2010-01-21 12:00 |
| 新手上路 Posts 8 Credits 18 | |
|
Can you find if there are any header files for DBF file operations?
|
|
| Floor3 mmxx0212 | Posted 2010-01-21 12:03 |
| 新手上路 Posts 8 Credits 18 | |
|
Please provide the specific Chinese content that needs to be translated so that I can carry out the translation according to the requirements.
|
|
| Floor4 liyangwyh | Posted 2010-01-21 12:46 |
| 初级用户 Posts 24 Credits 72 | |
|
Thanks everyone, the problem is found. It's that the space of str is too small and the data content exceeds it
|
|
| Floor5 firstsail | Posted 2010-01-21 12:53 |
| 高级用户 Posts 295 Credits 668 From 广东深圳 | |
|
This is too easy to understand,
Your recno is of type unsigned int, and the record number recnumber is of type unsinged long, so no matter how much recno is incremented, it can only change within 0~65535u. If recno is of type unsigned long, then printf("%u, %s\n",recno, str) should be changed to printf("%lu, %s\n",recno, str); |
|
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |