Adam Rosenfield

United States

adamrosenfield.com

Age: 27

Software engineer from Cambridge, MA

1d
comment Reading from stdin in a thread to write in a file in c
There are so many problems with this code: writing to stdin, int/char mismatches all over the place, calling atoi() on a char, not checking return values...
1d
awarded Great Answer
1d
answered FILE pointer in C not returning NULL
1d
answered What is the name of this Python comparison?
1d
comment pthread_posix_mutex - unable to achieve functionality
You can't unlock the mutex from the child thread when it hasn't been locked by that thread, that doesn't make any sense.
2d
answered Convert FILETIME to portable time unit
2d
answered CreateFileMapping returns ERROR_INVALID_HANDLE
2d
comment CURL output to windows named pipe
Why do you want to do this? Why not just use sockets on localhost using the loopback device?
2d
comment How does C++ look at a pointer to an unsigned char when it's treated like an array?
@nos: You beat me by 5 seconds :)
Jul
20
awarded Enlightened
Jul
20
awarded Nice Answer
Jul
18
answered Why the int type takes up 8 bytes in BSS section but 4 bytes in DATA section
Jul
18
comment How to disable/gray out a standard button (C++ Win32 API)?
What's so hard about EnableWindow(hwndButton1, FALSE) and EnableWindow(hwndButton1, TRUE)?
Jul
16
comment Initialising 'CGVector' aka ('struct CGVector') with an expression of incompatible type int
Do you also happen to have any earlier warnings about implicit declarations of any functions?
Jul
16
comment Do memory leaks have any effect after the program ends?
It's not good practice, but the OS will always clean up after you and deallocate any allocated memory you had (in reality, the OS only cares about virtual memory mappings—it doesn't know or care how malloc() is implemented, it just deals with calls to mmap(2)/munmap(2) or equivalent to map/unmap virtual memory addresses).
Jul
16
comment How to send float from java to C++ over socket connection?
+1, but note that the reinterpret_cast may not work with some compilers which respect strict aliasing; it's more portable to use a union, see stackoverflow.com/a/13982359/9530 .
Jul
16
revised format 12346 into phone number format 123-46
edited tags
Jul
16
comment Cannot fix read/write errors thrown up by Valgrind
@user3844996: In case I wasn't clear, I was asking you to post the code for the get_value() function; a vague description is not helpful. The code you've posted is not that helpful in diagnosing the problem, because there is so much missing context. The key, addr, cell, and cm variables are not defined in the code, so we have to use psychic powers to guess at what they might be. The variable new_cell is not used at all in this snippet after it's malloc'ed, beyond casting it to void** and storing that in pointer_position, which is also not used.
Jul
16
comment Cannot fix read/write errors thrown up by Valgrind
What does the get_value() function do? What is the mysterious cell variable being passed into it?
Jul
15
answered Connect to port using TCP with C
1 2 3 4 5