CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com

Search:

Type: Posts; User: cpthk

Page 1 of 2 1 2

Search: Search took 0.03 seconds.

  1. Does reuse variable make program faster or save some memories?

    If I have this code:


    void test(){
    Map *m1 = new Map;
    ....
    Map *m2 = new Map;
    ....
    }
  2. Replies
    1
    Views
    492

    Is CLR project for .net framework?

    I am new to the .net programming. I am trying to create the .net project in my visual studio, but I can't seem to find it. Is it the CLR? If it is, why not just name it .net, instead to confuse...
  3. Replies
    7
    Views
    929

    Re: IF statement question

    I have updated my code.
  4. Replies
    7
    Views
    929

    IF statement question

    Hi:

    If I have code:


    if(result != NULL && result.data != NULL){
    ...
    }
  5. Replies
    4
    Views
    878

    Simple create object question

    If I have a class:


    class test{

    public:
    test(){
    ...
    }
    };
  6. Replies
    3
    Views
    1,249

    Re: Reason to linker warning message 4217

    This code is directly copied from msdn site, I did not write that
  7. How to point iterator to the last element of map?

    I read the documentation, the


    map::end()

    points to the past-the-end element, not the last element of the map.
    The


    map::begin()
  8. Replies
    3
    Views
    1,249

    Reason to linker warning message 4217

    I got some LNK4217 error message. I read a little documentation here: http://msdn.microsoft.com/en-us/library/aa3se25k%28VS.80%29.aspx
    with example code:


    // LNK4217.cpp
    // compile with: /LD...
  9. Replies
    29
    Views
    11,226

    Re: How to convert string to char *?

    sorry, I am not allowed to do that. The function is written by another library. If I change the function, there are hundred of calls I need to update.

    @laserlight
    could you give me a code example?
  10. Replies
    29
    Views
    11,226

    How to convert string to char *?

    Here is my code:


    void func1(char * var1){
    ...
    }

    std::string str;

    func1( str... /* question here */ );
  11. Replies
    4
    Views
    777

    Re: Is this a safe code?

    yes, this is the question I want to ask actually.
    if I change to:


    std::string test(){
    std::string var1;

    var1 = "test";
    return var1;
    }
  12. Replies
    4
    Views
    777

    Is this a safe code?

    char * test(){
    char var1[10];

    var1 = "test";
    return var1;
    }


    var1 is a local variable, so I was wondering if I return the pointer to var1. Could memory of var1 being freed when the...
  13. Replies
    3
    Views
    858

    Re: class const variable

    so is there certain rule I should follow? I mean how do I know when I need static keyword, when I don't need? Can I ignore const keyword too?

    also what does this method called? setter? what...
  14. Replies
    9
    Views
    1,201

    Re: assign string question

    so even though we don't know where those strings are created, what's the reason not to change them? because some memory location could be read only?
  15. Replies
    4
    Views
    1,152

    Re: how to check if find_first_of is found?

    I don't understand is that is npos returning a number?
    What if I have several string here, does each string has its own npos? or npos only reflects the last call?
  16. Replies
    4
    Views
    1,152

    how to check if find_first_of is found?

    The documentation says if not found, npos is returned. How do I use that?


    first = tempString.find_first_of(" ");
    if(first == std::string::npos){
    ...
    }


    Is it something like this?
  17. Replies
    9
    Views
    1,201

    assign string question

    I read FAQ note from Gabriel Fleseriu here: http://www.codeguru.com/forum/showthread.php?t=231162

    He explained this is a bad programming practice:


    char* s = "Hello";
    s[1] = 'a'; ...
  18. Replies
    1
    Views
    895

    linker error help

    Hi:

    I am using many libraries in my project. I got this error:


    1>------ Rebuild All started: Project: test, Configuration: Debug Win32 ------
    1>Deleting intermediate and output files for...
  19. Replies
    3
    Views
    858

    class const variable

    Hi:

    I have seen code like this:


    class test{

    const static string var1;
  20. Replies
    3
    Views
    720

    throw exception quesiton

    My code:


    void func1() throw() {
    ...
    }

    void func2() throw(int) {
    ...
    throw(1);
  21. Replies
    9
    Views
    1,367

    Re: String parameter question?

    yes, but this works too:


    testFunc( std::string( "cool" ) + "foo" );


    The compiler knows to add a string with a pointer. How come?
  22. Replies
    9
    Views
    1,367

    Re: String parameter question?

    Thanks, it works.

    But why this one works:


    testFunc( "cool" );

    This one doesn't:
  23. Replies
    9
    Views
    1,367

    Re: String parameter question?

    Thanks for your help.
    But I tried, it doesn't work. It gives me 38 errors for that line.
    I also tried:


    testFunc( std::string a( "cool" ) + std::endl + std::string b( "foo" ) );

    Also doesn't...
  24. Replies
    5
    Views
    645

    Re: sub-class constructor question

    so how do I prevent it from calling the ABC destructor? I will need the ABC to be there for later usage.
  25. Replies
    9
    Views
    1,367

    String parameter question?

    This is part of my code:


    void testFunc(std::string){
    ...
    }

    testFunc("cool" + std::endl + "foo");
Results 1 to 25 of 47
Page 1 of 2 1 2





Click Here to Expand Forum to Full Width

Featured