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

Search:

Type: Posts; User: aryan1

Page 1 of 5 1 2 3 4

Search: Search took 0.01 seconds.

  1. Replies
    4
    Views
    1,377

    Re: crash caused by a 2D array

    Here is the prototype of the function:



    void fillTopoArray(string topoFileName, int topoGraph[][MAX_VERTICES], int *nodeCount, int *edgeCount);


    Here is how the parameter passed to the...
  2. Replies
    4
    Views
    1,377

    crash caused by a 2D array

    Hi All,

    I have a function such that one of its parameters is a 2D array of type int. The parameter is defined as follows:

    [code]
    int topoGraph [][MAX_VERTICES]
    [\code]

    However, the...
  3. Re: passing a multi-dimensional array to a function

    Thank you very much.

    Yes - that is the point that I was missing.
  4. Re: passing a multi-dimensional array to a function

    Below are two functions:



    void printGraph(const int* topology, int dimSize)
    {
    for(int rowIndex = 0; rowIndex < dimSize; rowIndex++)
    {
    for(int columnIndex = 0; columnIndex <...
  5. passing a multi-dimensional array to a function

    Hi,

    After passing the address of the first element (&array[0][0]) of a multi-dimensional integer array to a function with a "const int*" parameter, parameter seems to be pointing to the wrong...
  6. Replies
    1
    Views
    1,082

    theoretical limit on message queue sizes

    Hi All,

    Following function obtains the system-maintained structure for a message queue:



    bool getMessageQueueStats(int mqId, struct msqid_ds* buf)
    {
    if(msgctl(mqId, IPC_STAT, buf) ==...
  7. Replies
    10
    Views
    2,927

    Re: valgrind 's "invalid read" error

    No, there is no reason - It's just bad programming.

    When does an invalidation of a pointer take place ?

    I think that it depends on the layout of the memory at a certain time.

    Hence, even for...
  8. Replies
    10
    Views
    2,927

    valgrind 's "invalid read" error

    Hi All,

    Given the following piece of code in D.cpp :



    //set string myString
    //set boolean myBoolean2 and myBoolean1
    bool marked = false;
  9. valgrind 's "invalid read" error regarding boost

    Hi All,

    Given the following line numbered 780 in my_daemon.cc:



    exit(EXIT_FAILURE);


    valgrind generates the following invalid read error:
  10. Re: regarding the behaviour of gmtime() Linux system function

    This problem seems to be weird.

    At one execution of my program, time increment works fine, but on another run of my program at a later time, it does not. (I run it with the same user)

    After...
  11. Re: regarding the behaviour of gmtime() Linux system function

    My question was something else.

    Can you imagine any factor which may cause gmtime() or localtime() functions to behave differently for the same input at different times ?

    That is, I sometimes...
  12. Re: regarding the behaviour of gmtime() Linux system function

    To give an example to false looking result of gmtime(), given the following year/month/day/hour/minute input:

    2010/04/02/10/00

    The result returned by gmtime() is:

    2010/04/02/07/05, where...
  13. regarding the behaviour of gmtime() Linux system function

    Hi All,

    Following C++ function is expected to add 5 minutes to a certain date and time in "Broken-down time" format, and output the new date and time in the same format again:



    void...
  14. Replies
    7
    Views
    717

    how to erase entries in a map on-the-fly ?

    Hi All,

    I think that it is not legitimate to erase entries in a map in the following way:



    MyMap temp;

    //fill in temp here
  15. detecting newly created folders/files on local file system

    Hi All,

    Using C++, I want to process sub-folders on my home folder sequentially each with a special naming format and containing some binary files in it:



    1/
    2/
    3/
    4/
  16. Replies
    67
    Views
    6,468

    Re: counting consecutive null characters

    Thanks.

    This is much better.
  17. Replies
    67
    Views
    6,468

    Re: counting consecutive null characters

    What do you think about the function below ?



    int checkConNullBytes()
    {
    const char *BEGIN = dataStream.str().c_str();
    const char *END = dataStream.str().c_str() +...
  18. Replies
    67
    Views
    6,468

    Re: counting consecutive null characters

    Sorry, I admit that my question was not clear.

    If I have the following binary stream in hex representation:



    00 01 02 03 00 00 04 05 00 00 00 06 07


    what I want is to obtain the size of...
  19. Replies
    67
    Views
    6,468

    counting consecutive null characters

    Hi All,

    Is there any function in C++ 's standard library or in STL which gives the number of consecutive characters in a stringstream object ?

    std::count() and strspn() do not seem to be what I...
  20. tokenizing a string made of "only" seperator characters

    Hi All,

    Following function utilizing boost's string tokenizer class crashes as might be expected:



    bool CheckCommand(const string& cmd, const string& line)
    {
    if (line.length() == 0)...
  21. Replies
    11
    Views
    4,745

    Re: structure alignment on x86_64

    Let me clarify the reason why I posted this thread.

    Assuming we have following "u_char" binary data (call it myData) with hex representation of size 23 bytes :



    55 11 93 2b 55 6a 56 5c 60 2d...
  22. Replies
    11
    Views
    4,745

    Re: structure alignment on x86_64

    All the sizes for data types that I listed in my posting have been verified to be correctby using sizeof() statements.
  23. Replies
    11
    Views
    4,745

    structure alignment on x86_64

    Hi All,

    I want to define a C-struct as shown below, which will be written to a message queue:



    struct msg
    {
    struct in_addr addr1, addr2; // 4-byte
    u_int32_t s; ...
  24. Replies
    28
    Views
    9,656

    Re: how to detect NULL bytes in a char array ?

    So the following code snippet will do the job:



    const char *BEGIN = buffer;
    const char *END = buffer + 1000000;

    size_t numberOfNullChars = count(BEGIN, END, 0);
  25. Replies
    28
    Views
    9,656

    Re: how to detect NULL bytes in a char array ?

    What if I want to count for the number of NULL characters in a char array ?

    Given the following value for buffer with no terminating null character:



    buffer[0] = 'a'
    buffer[1] = 0...
Results 1 to 25 of 118
Page 1 of 5 1 2 3 4





Click Here to Expand Forum to Full Width

Featured