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

Search:

Type: Posts; User: Assmaster

Page 1 of 9 1 2 3 4

Search: Search took 0.06 seconds.

  1. Replies
    8
    Views
    923

    Couldn't you just try, and print'em out? ...

    Couldn't you just try, and print'em out?

    Anyhoo:
    // argc = the count of space separated "words" in the commandline:
    argc = 7

    // Each "word" has its own index in the argv array:
    argv[0] =...
  2. Thread: auto_ptr

    by Assmaster
    Replies
    5
    Views
    8,327

    Firstly... Like Andreas said... new should not...

    Firstly... Like Andreas said... new should not return NULL according to the standard. If allocation fails, it should throw a std::bad_alloc exception, and therefore you should not need to check for...
  3. Replies
    6
    Views
    937

    Some code would be nice... At the very least your...

    Some code would be nice... At the very least your fprintf line and the variables it uses.
  4. Replies
    2
    Views
    825

    So you basically want to stop using std::string...

    So you basically want to stop using std::string and std::vector, and instead use c-style strings and arrays?

    Well it will work. But why on earth would you want to do that? Stay with std::vector...
  5. Replies
    3
    Views
    1,029

    In fact... This won't work at all, and that's...

    In fact... This won't work at all, and that's probably the error you're recieving.

    When the compiler sees a templated function like yours, and you instantiate it for one type, it will compile the...
  6. Replies
    3
    Views
    1,029

    What's this m_bool variable? You've used it...

    What's this m_bool variable? You've used it twice, but havent defined it anywhere.

    And why does setdata need to be templated? If it's only to save you the trouble of writing one setdata for each...
  7. Replies
    11
    Views
    1,408

    Re: pointer question in C

    p++ would be the same address as &p[1]

    p[0] != p but *p

    p[1] != p+sizeof(data_type) but rather *(p+1).

    Also... p+sizeof(data_type) would only be the same address as p++ if data_type is char....
  8. Replies
    4
    Views
    776

    Umm.. I don't think I understand what you're...

    Umm.. I don't think I understand what you're asking, but there's nothing wrong with the single line of code you posted. (Except from a missing ';' that is!) And certainly nothing that should end up...
  9. Replies
    5
    Views
    895

    Erase only takes one iterator parameter. It's...

    Erase only takes one iterator parameter. It's simply .erase(i).

    But... What's with the usage of the this pointer here? You aren't by any chance deriving from std::list or something? In that case.....
  10. If you have already implemented the operator ==...

    If you have already implemented the operator == char* for your class (Looks like you have), and the Text member-variable contains the actual c-string:
    bool CStr::operator ==(const CStr& rhs)
    {...
  11. Replies
    12
    Views
    96,553

    The obious thing to do, would be to simply move...

    The obious thing to do, would be to simply move the definition of a into the for-loop's curlies. That way it will be constructed/destructed each iteration. (Giving you an empty stream each time)
    ...
  12. Replies
    20
    Views
    3,580

    Re: Thank everyone

    Is there any perticular reason you are using a char[10] and not a std::string?
    std::string Result;
    std::string Str("Hello Gurus, good day!");
    int n = 10;

    Result = Str.substr(Str.size() - n , n);
  13. Replies
    12
    Views
    1,152

    Re: Memory Allocation

    Why not use a std::vector?

    std::vector<int> temp(int n){
    int i;
    std::vector<int> array(n);
    for (i=0;i<n;i++)
    array[i] = i;
    return array;
    }
    This way the returned array will be...
  14. Replies
    2
    Views
    991

    Use a std::ostringstream to build the string...

    Use a std::ostringstream to build the string before passing it to the messagebox:
    #include <sstream>
    ...
    std::ostringstream message;
    message << "This is a text with a number: " << 100 << ", and...
  15. Replies
    5
    Views
    918

    Just square the value of the 8bit variable. The...

    Just square the value of the 8bit variable. The 8bit value 256, will then end up being 65536 (the max for a 16bit variable), but 0 will still be 0. Is that what you wanted?
    unsigned char some_value...
  16. Replies
    12
    Views
    1,523

    Since you are passing the struct as a cMyStruct*...

    Since you are passing the struct as a cMyStruct* to the function, how can you not know? The function will recieve a cMyStruct and since member-variable-names are known at compile time, just check the...
  17. Replies
    4
    Views
    755

    No it doesn't. You can't declare variables in the...

    No it doesn't. You can't declare variables in the header without using extern. That will lead to one variable being defined for each of the cpp files that include the header. This is the reason for...
  18. Replies
    10
    Views
    1,359

    I really don't understand why you need to do any...

    I really don't understand why you need to do any casting here. Assuming you only only have one CNode::SetVehicle function (no overloading), it will have to take a cvehiculo* as a parameter to be able...
  19. Thread: class

    by Assmaster
    Replies
    9
    Views
    1,356

    doNonVirtual() returns a void, and you're trying...

    doNonVirtual() returns a void, and you're trying to pass that to the << operator of cout. That shouldn't and doesn't work.
  20. Replies
    10
    Views
    1,359

    Well what type does the VehicleList.Add()...

    Well what type does the VehicleList.Add() function take as a parameter? I assume it's a cVehicle*, and in that case, it doesn't matter if the create function returns a cVehicle*, cCar* or a cVan*.
  21. Replies
    10
    Views
    1,284

    You shouldn't put "using namespace whatever;" in...

    You shouldn't put "using namespace whatever;" in any header file. Doing that will result in that namespace being used by all files that include your header. Something that in turn can result in name...
  22. Replies
    19
    Views
    7,754

    It's not a book, but a good reference none the...

    It's not a book, but a good reference none the less: http://www.sgi.com/tech/stl/table_of_contents.html
  23. Replies
    19
    Views
    7,754

    Use std::bitset: #include #include...

    Use std::bitset:
    #include <iostream>
    #include <fstream>
    #include <bitset>

    int main()
    {
    std::ifstream InFile("binary.txt");
    std::bitset<8> Byte;
  24. Replies
    11
    Views
    1,110

    Use an unsigned char. The value 129 overflows the...

    Use an unsigned char. The value 129 overflows the signed char variable.
  25. Replies
    6
    Views
    880

    You're trying to set the reference to the pointer...

    You're trying to set the reference to the pointer to NULL. C++ doesn't allow references to be NULL.
Results 1 to 25 of 205
Page 1 of 9 1 2 3 4





Click Here to Expand Forum to Full Width

Featured