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

Search:

Type: Posts; User: fiodis

Search: Search took 0.02 seconds.

  1. Re: Simple multiplication and division not evaluating correctly

    The complete program's several thousand lines split up among different source files. I'm never sure what to do when I need help with those; I know I should post as complete a program as possible,...
  2. Simple multiplication and division not evaluating correctly

    At one point in my C++, non-CLR program, the following code:

    unsigned int size = 3;
    float maxX = (float)(int(size-1))/2.0f;
    std::cout << maxX;
    outputs 107. I have no idea why; is it something...
  3. Replies
    19
    Views
    3,755

    Re: Modifying an existing array with a function

    I managed to get the functionality I needed by allocating the array on the heap, thanks guys. :)

    But I didn't know about static memory. Why is it called "static"? I can still change the value...
  4. Replies
    19
    Views
    3,755

    Re: Modifying an existing array with a function

    Hmm. It seems I'm thinking of pointers in the right way, but I'm having trouble creating an array in the first place. This:

    int main(int argc, char *argv[])
    {
    const unsigned int res = 512;...
  5. Replies
    19
    Views
    3,755

    Re: Modifying an existing array with a function

    Ah, sorry about that - this is C++, non-CLR code.
  6. Replies
    19
    Views
    3,755

    Modifying an existing array with a function

    I have an array of char representing pixels in a bitmap, which I want to modify. I don't think I can just iterate over the array and pass chars into a function individually, because the function...
  7. Replies
    5
    Views
    1,617

    Re: ofstream writing replaces entire file with 0s

    I see. Thanks everyone! :)
  8. Replies
    5
    Views
    1,617

    Re: ofstream writing replaces entire file with 0s

    Huh. That single line replacing the entire loop worked perfectly. Thanks! :)

    But what do you mean I was creating an empty file? You're right, filePathString is the path to a file that already...
  9. Replies
    5
    Views
    1,617

    ofstream writing replaces entire file with 0s

    I have a std::vector of short ints that I need to write to a specific location in a binary file (without using .NET code). To that end, I wrote up this code:

    ofstream fileStream...
  10. Replies
    5
    Views
    8,961

    Re: Convert 2-byte array to short int

    With that suggested code, I get an error:

    'std::basic_istream<_Elem,_Traits>::read' : cannot convert parameter 1 from 'short *' to 'char *'
    with
    [
    _Elem=char,
    ...
  11. Replies
    5
    Views
    8,961

    Convert 2-byte array to short int

    I'm having trouble reading a block of bytes into a vector of short ints. My code is as follows:

    FileStream.seekg(2821);
    vector<short> g_Data;
    int iter = 0;
    g_Data.reserve(maxNumOfInts);...
  12. Replies
    3
    Views
    1,286

    Re: Custom struct not working in C

    That could be my problem. What's the purpose of the tag, then? MSDN says it could be used to refer to the structure type in code later, but why can't you just use the name of the type?

    Sorry...
  13. Replies
    3
    Views
    1,286

    Custom struct not working in C

    Using VS2010, I defined a custom struct in the file vectorMath.h:

    typedef struct Vector
    {
    float v[3];
    };
    Then in main.c I have:

    #include <vectorMath.h>
    And, later on,
  14. Replies
    3
    Views
    793

    Re: Recompiling dll file

    Thanks! It's building, though with a few errors I'll have to sort out. Can I use Visual Studio to export it as a dll file? Searches only seem to describe how to do it with Visual Studio C++, not...
  15. Replies
    3
    Views
    793

    Recompiling dll file

    I've modified the source code for a .dll, but I'm not sure how to recompile it. I just opened one of the source code .cs files with Notepad and made a few changes. I think if I can load it in...
  16. Replies
    11
    Views
    7,669

    Re: Reading properties file

    Ah, I see. Again, thanks for the help, and thanks for the tip about Environment.Newline. :)
  17. Replies
    11
    Views
    7,669

    Re: Reading properties file

    Thanks! I was messing around with try/catch, but that code loads it perfectly (though newline in C# is \r\n instead of \n :) )

    I'm not quite sure how lists work, though I think I have a basic...
  18. Replies
    11
    Views
    7,669

    Re: Reading properties file

    Wow, I didn't know about IndexOf; that'll be useful. :)

    Unfortunately I get an error inside the while loop, again with the length parameter of Substring, this time saying that "Length cannot be...
  19. Replies
    11
    Views
    7,669

    Re: Reading properties file

    If by anything you mean code for reading it, I was trying to think of how to go about it when a friend suggested I use ReadLine to put each line into a string array, then for every property I could...
  20. Replies
    11
    Views
    7,669

    Reading properties file

    Hello,

    I'm trying to read a txt file that has properties laid out in the format:

    Info()
    {
    Texture("textureName");
    Angle(-90.000000);
    Ambient(255.000000, 255.000000, 255.000000); //rgb...
Results 1 to 20 of 20





Click Here to Expand Forum to Full Width

Featured