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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
B

bitsNbites

@bitsNbites
About
Posts
9
Topics
3
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • edit control
    B bitsNbites

    I have noticed that the on-kill-focus is not called for cases where the focus really doesn't leave the control, for example clicking on an icon or perhaps when you press the enter key? What I have done is to force a focus change. The first statement you should have within your method called by the enter click is to set focus somewhere. See if this then calls you on-kill-focus method for the edit box.

    If only I had more time!

    C / C++ / MFC help question

  • Linked list, passing a pointer
    B bitsNbites

    I have this C++ course and I have creatd a linked list with methods to insert and remove. The program works fine for me but for my instructor it crashes, for him, most likely since he uses his version of main. I can't trobleshoot my version, that easy, since it works. What I suspect is that my remove method wants an actual parameter of a pointer that points to a real address,(not null) and perhaps my instructors main is only sending a pointer. Is it possible to send a pointer, (of a user defined data type UDT) to a method and have that method set what this calling parameter will point to? I hope this makes sense. I have been spending many hours trying to learn all the ins and outs of pointers. Thanks If only I had more time!

    C / C++ / MFC c++ data-structures question announcement learning

  • simple keyboard input ?
    B bitsNbites

    I found the fix. I needed to remove the newline character since cin.get(name, length) leaves it(the newline char) in the buffer. The line to add is a simple "cin.get(discard);" where discard is declared as a char variable. I am using a while loop for the menu. This menu was seeing the newline char constantly. Thanks for your help, I'm still trying to learn all the little things of C++ like this one. Randy If only I had more time!

    C / C++ / MFC question c++ data-structures tutorial learning

  • simple keyboard input ?
    B bitsNbites

    Ok, these lines of code are directly from the MSDN. char line[25]; cout << " Type a line terminated by carriage return\n>"; cin.get( line, 25 ); cout << line << endl; This will run fine when placed in my main, (first lines). However when placed in a method of a class and called, via the user selecting from a menu, the screen continuously scrolls. Do I need to clear the buffer? Is it always this difficult to code in C++? I have been spending a couple hours just to code to take a line of text from the user. Also what is the "compile with: /EHsc" that the MSDN shows? If only I had more time!

    C / C++ / MFC question c++ data-structures tutorial learning

  • simple keyboard input ?
    B bitsNbites

    Yes this is a school Project. This C++ is really hard to master. I added one line and got 45 errors. I have to take input from the user and pass to a method which takes a pointer, a char pointer. So I create and fill an array and pass the first element address to the method. I think I have most coded right except that I get a continuous scrolling at line 21. 17 char sValue[30]; 18 int iData; 19 cout << " Enter a name for the Salesman \n" 20 << " limited to 29 chars:"; 21 cin.get(sValue,30); 22 this->SetAgentName(sValue); I took this directly from my book however the sample code in the book only has two lines (# 17 and # 21). There seems to be so many things that all interact to make C++ extra difficult. Can any one tell my why my screen constantly scrolls at the line with .get? If only I had more time!

    C / C++ / MFC question c++ data-structures tutorial learning

  • simple keyboard input ?
    B bitsNbites

    My C++ book says that trying to store more characters then the array has space for can cause problems. What the book I have doesn't tell me is how to prevent a user from entering too many characters. The code sample is; char name[31]; cout << " Enter your name: "; cin >> name; What is the best method to take text input from the user? If only I had more time!

    C / C++ / MFC question c++ data-structures tutorial learning

  • Multi arrays
    B bitsNbites

    Great that helps a lot. I now am using: int** q = new int*[rows]; for(int i = 0; i < rows; i++) q[i] = new int [col]; This works. MSDN states "Multidimensional arrays are not equivalent to arrays of pointers." It seems that here this code is creating just that. I suspect this is why I don't see the elements in the Autos window. I will play around with this for a while and will post new questions later. Thanks for the help. If only I had more time!

    C / C++ / MFC css data-structures help

  • Multi arrays
    B bitsNbites

    The code that has the error is not correct. I think I need to try a different method, but this is it. In the header I have an int pointer. int* sizeArray; Then in a function in the class. int row=22, col=20; sizeArray = new int[40]; // This is OK sizeArray = new int[row]; // This is OK sizeArray = new int[row][col];// This errors. "non-constant expression as array bound" and '=' : cannot convert from 'int (*)[1]' to 'int *' row and col will be values taken as arguments but for testing I just assign a value. If only I had more time!

    C / C++ / MFC css data-structures help

  • Multi arrays
    B bitsNbites

    What I want to do is take an input from the user to set up a grid. This grid is a multi- dimensional array. I can do this with a simple array (1-D) and create the object as new. But when I try this with a multi- dimensional I get the error "constant expression expected." If only I had more time!

    C / C++ / MFC css data-structures help
  • Login

  • Don't have an account? Register

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