In the C language: How do I convert unsigned long value to a string (char *) and keep my source code portable or just recompile it to work on other platform (without rewrite code)
For example with sprintf(buffer, format, value): how to determine the size of buffer with platform-independent manner
...
When debugging a link error (undefined reference to _dso_handle) using the Android x86 toolchain, I noticed it's statically linking crtbegin_dynamic.o. What is the purpose of this file? There is another similar crtbegin.o in the toolchain install directory that contains the missing symbol (_dso_handle). What is the difference between crt...
Hello, recently I've been trying to debug some low level work and I could not find the crt0.S for the compiler(avr-gcc) but I did find a crt1.S (and the same with the corresponding .o files)
What is the difference between these two files? Is crt1 something completely different or what? They both seem to have to do with something for boo...
Hello, this may be a silly question, but I want to calculate the complexity of one of my algorithms, and I am not sure what complexity to consider for the memmove() function.
Can you please help / explain ?
void * memmove ( void * destination, const void * source, size_t num );
So is the complexity O(num) or O(1). I suppose it's O(...
I used strtol to convert a string to hex, now I need to print it to the screen. I'm not sure if I can use sprintf since I only have 20k of memory to use on this board. Alternatives welcome.
...
Hello there,
How can I prevent a given app from creating a newline ('\n') after I request user input in C?
I'd like something like:
Type a number
Number: 3x10 = 30
The "x10 = 30" is added after the user inputs the number.. The problem is I can't do it on the same line (and I'd like to do it).
Can anyone help me?
...
hello
i have an char** arr which is an array of strings and i want to erase the 2 last cell of the array or maybe to create a new char** but without those last 2 cells
thank you very much.
...
The naive one is O(n). Is there a one that is O(log n) or even O(1)?
How about a sorted array? How about using binary search tree?
How about my array has a size n = [2 ^(h + 1)] − 1 ? // h=height of a complete binary tree
...
Although it runs correctly, the following results in the aforementioned compiler warning:
return ((item - (my->items))/(my->itemSize));
'item' is a 'void *'; 'my->items' is a 'void *'; 'my->itemSize' is an 'int'
Casting 'item' and 'my->items' as an 'int *' caused the program to run improperly. What is the best way to remove the war...
I'm currently helping a friend debug a program of his, which includes linked lists. His list structure is pretty simple:
typedef struct nodo{
int cantUnos;
char* numBin;
struct nodo* sig;
}Nodo;
We've got the following code snippet:
void insNodo(Nodo** lista, char* auxBin, int auxCantUnos){
printf("*******Insertando\n"...
Hi
I am trying to dump the floating point values from my program to a bin file. Since I can't use any stdlib function, I am thinking of writting it char by char to a big char array which I am dumping in my test application to a file.
It's like
float a=3132.000001;
I will be dumping this to a char array in 4 bytes.
Code example woul...
I need to know the C program used to transfer pixels of a real time video image of size 160*120 into another table of same size using array
...
I am using glibs functions to convert epoch time to string as follows.
But each time it is giving me some random time.
//Convert Time in string.
GDate *date = g_date_new_julian(timestampsecs);
gchar date_string[50];
g_date_strftime(date_string, 50, (const gchar*)"%a, %I:%M %p", (const GDate*)date);
printf("Date String [%s]\n", date_st...
in this code i don't understand why teacher used sometimes +value, - value;
/******************************************/
// function void returnSquares(POINT point, int value)
void returnSquares(POINT point, int value) {
SQUARE tabSquares[4]; // table of squares that we are creating
int i;
// getting points of 4 squar...
In the many search functions of C (bsearch comes to mind) if a result is found, a pointer to the spot in the array is returned. How can I convert this pointer to the index in the array that was searched (using pointer arithmetic, i assume).
...
In the nautilus-python bindings, there is a file "nautilus.defs". It contains stanzas like
(define-interface MenuProvider
(in-module "Nautilus")
(c-name "NautilusMenuProvider")
(gtype-id "NAUTILUS_TYPE_MENU_PROVIDER")
)
or
(define-method get_mime_type
(of-object "NautilusFileInfo")
(c-name "nautilus_file_info_get_mime_type"...
HI all,
Is there anyway by which we can declare variable specifying bit fields on those which are not any members of structures or unions.If not,then is there anyway by which we can just declare a variable by specifying the number of bits it is permitted to use.
Thanks
maddy
...
Hi everyone!
I need a powerful HTML parser and manipulator for Objective-C/C, like HTML Agility Pack.
Can anyone tell me some optimal solution? One solution is libxml2, but it seams is not the best.
Thanks in advance!
...
For example:
#define FOO(x) (printf(x))
and
#define FOO(x) {printf(x)}
It seems that both are viable for preprocessing, but which is better?
...
I have seen this sample written in Ruby code, how i can simulate it in C language?
Open3.popen3(command) do |stdin, stdout, stderr|
@stop_stdin = stdin
while !stdout.eof do
output = stdout.read(1024 * 100)
list_pipes.each do |out|
out.print output
end
end
end
...