qsort无法排序(Windows 7) [英] qsort failing to sort (Windows 7)

查看:77
本文介绍了qsort无法排序(Windows 7)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Windows 7 Enterprise上运行,并且我有一个例程,该例程从各种来源收集数据,并将数据格式化为相当大的数组中的30个字符条目(不到104k条目).我使用qsort使用一个偏移量= 0,长度= 30和计数= 103964的键将字符数据按升序排序.所有操作都非常简单.这种排序似乎在尝试对数据进行排序,因为我可以观察到初始条目已按升序排列,但是比较array(k)与array(k + 1)的简单循环发现了很多情况,其中条目超出了命令.跳到数组的末尾(我使用调试器),可以观察到条目远不及任何顺序.就像排序算法在中途失效一样.有什么方法可以确定qsort是否对我退出了? (不幸的是,完成后它不会返回任何值).

谢谢

I am running on Windows 7 Enterprise and I have a routine that gathers data from various sources and formats that data into 30 character entries in a rather large array (just under 104k entries). I use qsort to sort the character data into ascending order using a single key with offset = 0, length = 30 and count = 103964. All very straightforward. The sort seems to make some attempt at ordering the data since I can observe that the initial entries have been put into ascending order but a simple loop comparing array(k) to array(k+1) finds numerous cases where the entries are out of order. Jumping to the end of the array (I''m using the debugger), I can observe that the entries are nowhere near any kind of order. It is as if the sorting algorithm died mid-stream. Is there a way I can determine if qsort is quitting on me? (unfortunately, it does not return any value upon completion).

Thanks

推荐答案

这绝不是W7问题.这是您的代码无效,您应该先在调试器中查看它,然后在需要帮助的情况下将其发布在此处"问题
No way is this a W7 issue. It''s a ''your code doesn''t work and you should look at it in the debugger first, then post it here if you expect help'' issue


这篇关于qsort无法排序(Windows 7)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆