Basically i am having problems with my code - this is homework so would rather not post it in here for obvious reasons. If it becomes truely important for me to do so then i will have to as i am so stuck.
i am reading 2 text files and it also has a seperator , these values come from the command line, just assume that the seperator in th...
This is C4055 Warning message.
'conversion' : from data pointer 'type1' to function pointer 'type2'
A data pointer is cast (possibly incorrectly) to a function pointer.
This is a level 1 warning under /Za and a level 4 warning under /Ze.
How do we resolve this warning?(By correct way, not a trick)
Edit:
This is a code...
Hi - I'm trying to read an image file and scale it by multiplying each byte by a scale its pixel levels by some absolute factor. I'm not sure I'm doing it right, though -
void scale_file(char *infile, char *outfile, float scale)
{
// open files for reading
FILE *infile_p = fopen(infile, 'r');
FILE *outfile_p = fopen(outfile...
When I run gcc with the parameter -fdump-rtl-jump, I get a dump file with the name file.c.135r.jump, where I can read some information about the intermediate representation of the methods in my C or C++ file.
I just recently discovered, that the static methods of a project are missing in this dump file. Do you know, why they are missing...
I notice that the character/symbol '`' and '@' is not used as an operator in C/C++,
does anyone know the reason or historically why its so?
if its really not used, is it safe to define those symbols as another operator/statement using #define?
...
I have a job interview next week that requires me to be able to demonstrate the following skills:
C
C++
SystemC
3D
Video
Digital communication
RTL (register transfer level)
Usually before an interview, I create a quick application just to refresh my knowledge of all the skills required, but I can't think how to combine all of these i...
I'm looking at a simple, programmatic way of detecting whether or not the user has drawn a circular shape. I'm working in C, but am happy to work from pseudo-code. A bit of Googling brings up a number of (hopefully) overly-complex methods.
I'm tracking the mouse coordinates as floats, and have created an array of vectors to track the mo...
What's the equivalent of php's in_array or IList.Contains in C#.net. I'm a C n00b but I know very little is buit-in. If I have to do this myself, what's the best way? iterate over the array and test each value?
...
Does anyone know what is required to be able to read and write to a sqlite database from a c program on mac os x? I have found the sqlite3 commandline tool on os x, but there doesn't seem to be a sqlite.h file anywhere. It's my understanding that coreData can use the sqlite format, the whole thing is quite confusing. When I have looked f...
I have an array with 16 elements. I would like to evaluate these to a boolean 0 or 1 and then store this in 2 bytes so i can write to a binary file. How do I do this?
...
The C source codes that I am trying to port into 64 bit runs without any warning in the 32 bit environment. When I compile in 64 bit linux environment with the compile gcc (Ubuntu 4.4.1-4ubuntu9) 4.4.1, it shows the following warning mostly:
warning: cast to pointer from integer of different size
The above warning were the most. I us...
Just curiosity from a c noob.
strchr in std c library looks for a char in a string right?, yet it's signature takes an int c for the search char. And in these two implementations I found, it casts c into to a (char).
Does anyone know why? Why not just take a char as parameter?. Thank you
char *strchr(const char *s, int c) {
whi...
Is there an easy way to remove comments from a C/C++ source file without doing any preprocessing. (ie, I think you can use gcc -E but this will expand macros.) I just want the source code with comments stripped, nothing else should be changed.
EDIT:
Preference towards an existing tool. I don't want to have to write this myself with reg...
In C/C++, is there an easy way to apply bitwise operators (specifically left/right shifts) to dynamically allocated memory?
For example, let's say I did this:
unsigned char * bytes=new unsigned char[3];
bytes[0]=1;
bytes[1]=1;
bytes[2]=1;
I would like a way to do this:
bytes>>=2;
(then the 'bytes' would have the following values):...
What is the fastest way to read every 30th byte of a large binary file (2-3 GB)? I've read there are performance problems with fseek because of I/O buffers, but I don't want to read 2-3 GB of data into memory before grabbing every 30th byte either.
...
Hi there, given a string say " a 19 b c d 20", how do I test to see if at that particular position on the string there is a number? (not just the character '1' but the whole number '19' and '20').
char s[80];
strcpy(s,"a 19 b c d 20");
int i=0;
int num=0;
int digit=0;
for (i =0;i<strlen(s);i++){
if ((s[i] <= '9') && (s[i] >= '0')){...
I last used C professionally around 1997 IIRC. I've used a lot of C++ since then. Now, I find I need to use some C again.
One thing I'm sure of is that I can't just drop the obvious C++ features (e.g. classes) and expect everything to work. There are various less obvious syntax changes. I just don't remember what they are.
Is there a g...
Many system calls in Unix use overloading and default variables. This concept is absent in C, so Unix is coded in C++ also right?
...
Ok so I'm having trouble with my linking of files.
Basically, my program works:
the main program, is gen1
gen1 - recieves input sends to str2value for processing, outputs resaults
str2value, brakes input into tokens using "tokenizer" deterines what sort of processing to do to each token, and passes them off to str2num, or str2cmd. then r...
The string input would be
> bc <address1> <address2> length
I can break the string into tokens using strtok but not sure how to take each separate token and for example convert address1 and address 2 to hex.
void tokenize()
{
char str[] ="bc 0xFFFF0 0xFFFFF 30";
char *tkn;
char *tkn2;
tkn = strtok (str," ");
while (tkn != NUL...