Don't you need to cast the first parameter to (const void *) in fwrite.
Type: Posts; User: stumpster123
Don't you need to cast the first parameter to (const void *) in fwrite.
Oh boy I am sorry, definately should have done that. I fixed it here.
#include <stdio.h>
#define MASK 0x80000000
int main()
{
int x, t, i;
for(x =1; x <= 256; x++)
This is a good beginner tutorial it has basics on classes and file I/O
Tutorial
You would need a hash function too, that will generate the key.
Here is a good hash function
int hash_example (char *s, int T)
{
int h = 0;
for (; *s != 0; s++)
h = (h << 5) ^ (*s)...
Yeah that's my biggest question why does it matter what the name of the class. If a user is using a program he doesn't need to know the details like the name of a variable or a class. I mean maybe...
I Don't understand why you would want to do that. Is there a specific reason?
He means if you divide by 0 your program will crash. Try going from 1 to 7 or something by incrementing fight after it is generated.
You could do this too,
#include <stdio.h>
#define MASK 0x00000001
int main()
{
Yeah I was just too lazy to look it up but it still wouldnt fit
Well thats the problem there are no data types that can fit numbers that large especially double. I know there is a quad type, which is 128 bits, but its only for special machines and i dont even...
I don't know of any data type that can hold a value as large as 5e60 that is a gigantic number and a double will never be able to hold that it goes to like 2e9 about. Maybe you could just take away...
you should write a function to insert each node into the list. If you want to insert into the front of the list it isnt too hard. Heres some pseudocode.
void new_node(struct list ** pHead, ...
Well fseek just moves around the file pointer you would still need to use fscanf or fread to read in the integer.
Try using this call instead
student::readfile(filename, &ctr, ARRAY);
Well when you use fscanf with a char array u can just send the variable not the address.
fscanf(f, "%s", line);
That will only read until it reaches white space so Fri will be put into line.
...
Easy if you want to print an integer in hexadecimal you don't need to use any function just use printf with the %x flag as follows.
printf("%x\n", int);
If you want to convert it from binary...
I would say you can't do this because it is a function not a data type and is not accessed like a data type.
You can type cast the variable to an int or just save it to an integer variable for example.
(int)charvariable
int iVar = cVar;
The only problem with that is when the char is representing...
Yea but remember a string is an array of characters so technically it is a 2d array still. Even though it is malloced and not a specified length to begin with you would still access a single char...
You are going to have to use a 2 dimension array to do that.
Because if you think about it the array of strings is also a 2 dimensional array also it is just initialized differently.
Thanks dave that worked perfectly.
Yeah that is what read info is doing before it reads anything. It opens the file and uses the file pointer that is sent from main function. I am using an array so the function call is in a for loop...
In my main function I have an array of File pointers like this:
FILE *fInfile[MAXFILE]
and my functions header is
int read_info(FILE *fA, FILE *fI);
{
lol got back to the post too slow otherwise I would have posted it. Don't worry i can do it but quzah beat me to the punch.
Ok i see sorry i read the initial question wrong. You want to break the list in half where the even nodes go into on sublist and the odd go into another. This can be done like this
for(i = 0;...