I have made a program in c and wanted to see, how much memory it uses and noticed, that the memory usage grows while normally using it (at launch time it uses about 250k and now it's at 1.5mb). afaik, I freed all the unused memory and after some time hours, the app uses less memory. Could it be possible, that the freed memory just goes f...
I have an embedded environment with a limited amount of storage available. I want to run an SFTP server in this environment and the Linux version I'm using does not contain one.
Does anyone know of a set of c-libraries for a Linux SFTP server that is lightweight? (ie. the binary is small in size, much less than 1MB)
NOTE: The librarie...
I have included the code below. The program is supposed to accept telnet connections on port 8888 and then send and messages from each telnet client using poll and send and recv but It doesn't quite work 100%. It seems certain connections can always send messages to anyone and the program works fine but there is always at least one clien...
We all know the trouble overflows can cause, and this is why strn* exist - and most of the time they make sense. However, I have seen code which uses strncmp to compare commandline parameters like so:
if(... strncmp(argv[i], "--help", 6) == 0
Now, I would have thought that this is unnecessary and perhaps even dangerous (for longer par...
On the discussion of dynamic memory here: "Intro to C Pointers and Dynamic Memory"
The author states:
A memory block like this can effectively be used as a more flexible array. This approach is actually much more common in real-world C programs. It's also more predictable and flexible than a "variable size array"
The type of memor...
I'm trying to write a program in C (on linux) that loops until the user presses a key, but shouldn't require a keypress to continue each loop.
Is there a simple way to do this? I figure I could possibly do it with select() but that seems like a lot of work.
Alternatively, is there a way to catch a control-c keypress to do cleanup befor...
I'm getting the folowing error for below code,
"1506-221 (S) Initializer must be a valid constant expression"
FILE *fp[] = {stdout, dump_f};
is this acceptable? what is the proper way to achive this?
...
I know C pretty well, and I need to learn C++ pretty quickly. Does anyone know of any books, that assume a decent knowledge of C, and then goes over C++?
...
I want to know more about "Why can’t variables be declared in a switch statement?"
I read the post but i am not getting it exactly.
You can just declare variable inside switch but to decalre and initialize a variable or to declare object of class it gives complie time error.
Please explain me....
...
If you are writing a multi-threaded application that uses system/library calls that make use of errno to indicate the error type, is there a safe way to use errno? If not, is there some other way to indicate the type of error that occurred rather than just that an error has occurred?
...
I am looking for a good Integrated development environment for developing applictaions in C language for both windows and linux.
IDE should have:
good interface,
easy file management,
auto filling and
any advanced options.
Tell me which IDE you most admire for these tasks
For general PC application development
For embedded app...
I'm trying to find out if a child process is waiting for user input (without parsing its output). Is it possible, in C on Unix, to determine if a pipe's read end currently has a read() call blocking?
...
Is there a rough equivalent to the Linux/Unix stdio.h popen() function in the Win32 API? If so, where can I find it?
Edit: I need to know this to patch an omission in the D standard library. Any answer must use only standard Win32 API, no MSVC-specific functions. Also, I'd prefer something that's not horribly low-level, if it exists...
Hello,
I have to do some work work with integers, but I am interested in treat them as binary data, in a way that for example I can take the 4 most significant bits of an 32 bit value. What I am trying to do is, I have several 32 bit value I want to take for example, in the first one 4 bits, the second one 6 bits and the last one 22 bit...
I am wondering how I can define an object in C whose reference will be null?
// definition of foo
...
void * bar = &foo; // bar must be null
There is some ways I could find to do it, but none fit my needs.
__attribute__((weak)) extern int foo; //not working with cygwin/gcc 3.4
__attribute__((at(0))) int foo; //only with rvds
#...
Given that signed and unsigned ints use the same registers, etc., and just interpret bit patterns differently, and C chars are basically just 8-bit ints, what's the difference between signed and unsigned chars in C? I understand that the signedness of char is implementation defined, and I simply can't understand how it could ever make a...
As of now I'm using below line to print with out dot's
fprintf( stdout, "%-40s[%d]", tag, data);
I'm expecting the output would be something like following,
Number of cards..................................[500]
Fixed prize amount [in whole dollars]............[10]
Is this a high winner prize?.....................[yes]
How to prin...
I'm looking for an algorithm, or at least theory of operation on how you would find similar text in two or more different strings...
Much like the question posed here: http://stackoverflow.com/questions/246961/algorithm-to-find-similar-text, the difference being that my text strings will only ever be a handful of words.
Like say I have...
I was looking over this code to calculate math.sqrt in Java. I was just wondering why they used hex values in some of the loops and as normal values for variables. What benefits are there to use hex?
Thanks for your help.
...
Related to:
Testing firmware
starting a microcontroller simulator/emulator
Interpreting assembly code
If you are writing code for a microcontroller is there a real difference if you write in assembly or C or some other high level language? If you wrote C code, how would you compile it?
Thanks
...