Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
A

Andrew Phillips

@Andrew Phillips
About
Posts
10
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Windows 7 compatible code in VC++ MFC
    A Andrew Phillips

    If you have a program that runs for example on XP but has problems on Windows 7 you can run it in compatibility mode. See the compatibility tab in the Properties dialog. (Right click the .EXE and select Properties in Explorer.) If you are asking if you need to change anything when moving from VS2003 to a later version of Visual Studio then you may find that you need to #define the WINVER appropriately - ie to earliest version of Window you want to be able to run on. The default value may be different if you didn't explicitly set it in your VS2003 project. You may have some problems rebuilding but you can ask here if so. If you are talking about adding code to make use of new features in Windows 7 then you will have to find out about the features and how to implement them. There are many new features in Windows 7, eg for the new task bar. If using MFC many Windows 7 features are automatically used or implemented with a just few lines of code when you rebuild your application with VS2010. Also re 64 bit Windows: If you write code portably then you can compile for Win32 or Win64. If Win64 is the target it will run faster under 64-bit Windows but won't run under Win32. But if you just target it for 32-bit then it can run under Win64 and Win32.

    Andrew Phillips http://www.hexedit.com andrew @ hexedit.com

    C / C++ / MFC

  • linked list adding operation with two structure type
    A Andrew Phillips

    > printf("%s\n", list->head->first_name ); Yes, this should work. It could be that list or list->head are NULL or uninitialised. Try: printf("%p %p %s\n", list, list->head, list->head->first_name ); which will print out the values of the pointers. Or step through the code and look at the values in the debugger.

    Andrew Phillips http://www.hexedit.com andrew @ hexedit.com

    C / C++ / MFC

  • MFC calculator with huge real....
    A Andrew Phillips

    You need to be a bit clearer on what you want. "32 digits" implies decimal digits but I suspect you may bew talking about 32-bit numbers (ie 32 binary digits) or perhaps 32 hex digits. Also do you just want to calculate using these large numbers or do you want code for a calculator type program with buttons etc. My best guess is that you just want to do calculations on big integers up to 32 hex digits (128-bits). These sorts of numbers are use in things like encryption. I have used the code in this article with success: C++ Integer Class[^].

    Andrew Phillips http://www.hexedit.com andrew @ hexedit.com

    C / C++ / MFC

  • compression
    A Andrew Phillips

    In the past I have often had to do this - ie compress data/files. The best way is to use zlib as it is a defacto standard, open-source, unencumbered by any patents/licensing limitations and is supported in a large number of languages and environments. See http://zlib.net/[^]. You can also use my open source hex editor to play with all the options and features without writing any code. See HexEdit - Window Binary File Editor[^].

    Andrew Phillips http://www.hexedit.com andrew @ hexedit.com

    C / C++ / MFC

  • linked list adding operation with two structure type
    A Andrew Phillips

    This is obviously an assignment but I'll give you some ideas. a. It's better to use an existing container like std::list but if this is C and you don't have one or you have to write your own linked list then ... b. You don't need to store current. I also assume you store tail and count for efficiency as you can work these out too. c. You store tail but then in add_Node() you scan the list for the end anyway. d. It may be simpler just to add new students to the start of the list rather than the end.

    NODE \* tmp = head;
    head = student;
    student->next = tmp;
    

    e. If you step through your code the bvious problem is assigning through a NULL pointer. Why not do it like this:

    void add_Node(LIST** list, NODE* student)
    {
    NODE ** pcurr;
    for (pcurr = &head; *pcurr != NULL; pcurr = &((*pcurr)->next) )
    ; // no loop body
    *pcurr = student;
    student->next = NULL;
    }

    Andrew Phillips http://www.hexedit.com andrew @ hexedit.com

    C / C++ / MFC

  • C++ program and my __asm
    A Andrew Phillips

    There are several issues here: a. As already mentioned there is no point in using inline assembler for a function call. Inline assembler is occasionally (but very rarely nowadays) used for efficiency or for doing some low-level hardware things. But even if you have to use assmebler for something you can move results to local variable(s) for passing to functions in normal C/C++ code. b. You can't just do a "call" to an arbitrary memory location (as in your 1 and 2 examples). You have to use some sort of symbolic name so the linker can resolve the addres and the loader can adjust addresses when the program is run. c. Your example 3 looks like it could work but I think you are pushing the parameters onto the stack in the wrong order. d. Where does the code crash? I suspect in the call to WinExec but you can step through the code in the debugger to see exactly where it goes wrong. (Use Debug/Windows/Disassembly menu item to get the assembler code in the debugger.) e. Check what registers you can use in an _asm {} block. I think eax is safe but you may have to save (ie push and later pop) others like ebp before using them.

    Andrew Phillips http://www.hexedit.com andrew @ hexedit.com

    C / C++ / MFC

  • Interview questions - best way to learn the answers
    A Andrew Phillips

    Thanks for your reply Marc. Re iterative development - I tried it with little success. However, I keep an open mind. I would love to hear from you if you have time to sen me something.

    Andrew Phillips http://www.hexedit.com andrew @ hexedit.com

    The Lounge

  • Interview questions - best way to learn the answers
    A Andrew Phillips

    In a recent job interview I was asked what polymorphism meant. I explained that when refrerring to software the term is the exact opposite of the proper meaning. Polymorphism traditionally means a thing that has different outward appearances -- a compound with different crystal structures or a species with different forms (the only example I can think of is a tadpole and frog). In software design it seems to mean different things that have the same outward appearance (interface). Anyway, I didn't get the job. BTW, Marc your articles on CP inspired me to write one - http://www.codeproject.com/KB/architecture/develmethodologies1.aspx.

    Andrew Phillips http://www.hexedit.com andrew @ hexedit.com

    The Lounge

  • Breakpoint window improvements
    A Andrew Phillips

    Actually they are persisted with the open solution, but only only the files you have open when you close the solution. This is not really much use as I open many files and don't want to keep them all open. Andrew. Andrew Phillips aphillips @ expertcomsoft.com

    Visual Studio

  • Breakpoint window improvements
    A Andrew Phillips

    Navigating large amounts of source code is a burdensome task that I have been trying to make easier for myself for years. Visual Studio has lots of facilities but none of them work well. Bookmarks are great but they are not persistent (I know there are add-ons to do that) and you can't get a list of them. (What happened to VS6 named bookmarks?) The new Navigate Forward/Backward and the Task List facilities sound really useful. In practive they are confusing and clumsy. :( What I mainly use now is breakpoints as a type of bookmark. Often a bit of code where you want to place a bookmark is also where you want to set a breakpoint anyway. VS.Net has greatly improved the support for breakpoints. :) There is now a breakpoints window and you can jump to one just by double clicking it. When you have finished with it as a breakpoint you can disable it to just use it as a bookmark using the checkbox next to it in the breakpoint window. It is also possible to set a large number of related breakpoint/bookmarks using the Function tab in the "New Breakpoint" dialog. Eg, if you type in the name of function like OnInitDialog you get a list of all occurences of that function in the project and you can select any or all of them to have a breakpoint. What I really like is that you can easily set breakpoints on all member functions of a class by typing the class name in the function name field (in New Breakpoint dialog). You can then set breakpoints on any/all member functions. Though an improvement would be to be able to see const/non-const members - I often want to set breakpoints on all non-const mebers so I can find out where an object is being modified. My only concern is that having a large number of breakpoints seems to slow the IDE down a little, even when disabled. This is just an impression -- I haven't done any tests to confirm this. Anyway the point of this post is that even though I love the new breakpoints window it could be improved. It would be nice to be able to group breakpoints using folders, like you can in ClassView and Solution Explorer windows. It would also be nice to be able to attach a name or description to a breakpoint, for obvious reasons. Andrew. Andrew Phillips aphillips @ expertcomsoft.com

    Visual Studio
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups