Structures, Arrays, Sums...

This is a discussion on Structures, Arrays, Sums... within the C Programming forums, part of the General Programming Boards category; I was wondering if any one could help, point me in the right direction or offer any advice with my ...

Structures, Arrays, Sums...

I was wondering if any one could help, point me in the right direction or offer any advice with my problem. The position within the file of the record is decided by this algorithm

result = data->vehicle_reg[0] - 'A';
/*First letter of the registration minus the int value of A */
position = (result *1000)+ data->vehicle_reg[1,2,3];
/*Result of first part mutiplied by 1000 and with the first
three digits of the registration added*/

You need to give more information to go on. How exactly does this translate to where in the file this records is stored? What position in the file does your example fall into, and why?

You need to provide more information. How many records are there total? Can they be added on a whim and if so, will they be automaticly sorted into the "correct" position in the file, updating all others? There is not enough to go on.

The 'position' generated is the files position, and where it will be written to, it's a random access file (Txt) and will contain 26000 records in total. The records are added only afte checking that a record does not exsist at the positon generated, if so the program will look for places after, the number...

The algortihm will take the integer value of the first character (of the registration), and subtract the integer character of 'A' from it and then multiply the result by 100. The next three digits are added to to give the record number.

I hate Jello. specially the green Jello. People that eat Jello should all die. Why can't everyone understand that the blue Jelly is about 1000 times better. I rather eat worms then Jello.
Hey whos that?, on the chair drinking beer and eating popcorn?

Originally posted by Barjor I hate Jello. specially the green Jello. People that eat Jello should all die. Why can't everyone understand that the blue Jelly is about 1000 times better. I rather eat worms then Jello.
Hey whos that?, on the chair drinking beer and eating popcorn?

Yeah. Jello is rather nasty. After all, it's made from the bones of horses which have been processed with acid. Just look up what gelatin is made from...