it has been a while since I messed with C code.
I am getting the following error when compiling C code under ubuntu using gcc.
command i am using to ...
I'm using the read function to take in one character, then running the read function again. Before I run the function again, I want to save what's in the buffer ...
You are compiling this code as C++ although it looks like C code. C will implicitly cast void* to char*, or indeed any other pointer type; C++ wont. Either compile the code as C or cast the output of malloc to char*. Oh and next time copy and paste the actual compiler errors because the error you are getting is not ...
Hi! I have a program and in this program I have to do a lot of closes and frees. The program is something like this: static int finalize(FILE* f1, FILE* f2, char* c) { if (f1 != NULL) { fclose(f1); } if (f2 != NULL) { fclose(f2); } if (c != NULL) { free(c); } return 0; } int main(int argc, ...
char *read_cach(char x[]) { int chk=0,i,line; char *data=malloc(8); // Error here hex2bin(x); //assigns a int array x_bi with binary value of hexa D x[32] line=bin2dec(); for(i=0;i
if I used an argument passed in as void* a to assign an integer: *(int *) a = intValue; and also want to assign a char in certain cases: char *myChar = new char[10]; (char *)a = myChar; do i have to pass the argument as 'void *&a' instead of just 'void *a' ? tha caller of the method would know ...