Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2014
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. #include <windows.h>
  2. #include "stdafx.h"
  3. #include "List.h"
  4.  
  5. typedef struct List_Node
  6. {
  7. LIST_ENTRY list;
  8. int val1;
  9. }LIST_NODE, *PLIST_NODE;
  10.  
  11. int _tmain(int argc, _TCHAR* argv[])
  12. {
  13.  
  14. int i = 0;
  15.  
  16. PLIST_NODE pNewnode;
  17. pNewnode = new LIST_NODE;
  18.  
  19.  
  20. LIST_ENTRY head;
  21.  
  22. InitializeListHead(&head);
  23.  
  24. for (i = 0; i < 3; i++)
  25. {
  26.  
  27. pNewnode = new LIST_NODE;
  28. pNewnode->val1 = i;
  29. InsertTailList(&head, &pNewnode->list);
  30. pNewnode = NULL;
  31. }
  32.  
  33. while (!IsListEmpty(&head))
  34. {
  35.  
  36. PLIST_ENTRY removeNode = RemoveHeadList(&head);
  37.  
  38. PLIST_NODE mydatanode = (PLIST_NODE)CONTAINING_RECORD
  39. (removeNode,LIST_NODE,val1);
  40.  
  41. printf("%dn", mydatanode->val1);
  42. }
  43.  
  44.  
  45. return 0;
  46. }
  47.  
  48. PLIST_ENTRY removeNode = RemoveHeadList(&head);
  49.  
  50. PLIST_NODE mydatanode = (PLIST_NODE)CONTAINING_RECORD(removeNode,LIST_NODE,val1);
  51.  
  52. PLIST_ENTRY removeNode = RemoveHeadList(&head);
  53.  
  54. PLIST_NODE mydatanode = (PLIST_NODE)CONTAINING_RECORD(removeNode,LIST_NODE,list);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement