the files are opened using 'r', and closed using 'w'.
The data is written correctly,
mem1
Blue Bob
C Board
0
But when it is read back in, and printed out, a new line is taken after each...
Type: Posts; User: bluebob
the files are opened using 'r', and closed using 'w'.
The data is written correctly,
mem1
Blue Bob
C Board
0
But when it is read back in, and printed out, a new line is taken after each...
well it dont seem to work. The data is written correctly, but when it is read in, it is not firmatted properly. Their are massive gaps between fields, and some data is not displayed. This has been...
Ive tried using fgets and fscanf, but neither recognise a spaces, they regard them as being the end of the input.
Are there anything else i can use? Below is a copy of one of my read in lines.
...
If i use a memory dump i will lose marks! Thats why i didnt use it.
I will try to use the one function to read from now on though.
BlueBob
Here ya go, an example of a typical members file.
Whats wrong with using feof? i was told on this board to use it!
BlueBoB
mem1
Scott Harkins
South Cobberville
0
mem2
The data is written correctly to the external file. In the correct order and format. But when read back in, the format is changed, and the data is not displayed correctly. Is their something wrong...
Ahh, ive jus read in the book that fscanf does not recognize space's. So i have to use fgets()?
How would i change this-
fscanf (memberRead, "%s\n", MemberData[counter1].membernumber);
to use...
I have a stucture of arrays that holds data such as member number, videonumber,and rental date.
How would i go about deleting from the structure one of these records?
BlueBob
I can now write correctly to the external files. But when i read the data back in to the program, it does not seem to recognize spacing? is this something to do with the use of fscanf?
any ideas?...
I can open the files, and add to them. They are written to correctly, But when i re-run the program, the files are not read in, Any ideas why?
extern int m; // number of members
extern int i; //...
Ive amended my code, and now it does not crash (apart from when writing video data to the video external file.
But, when i re-run the program, none of the data is read in. The program runs...
No, three different files.
Cheers Shiro. It was a problem with my account, not yours, sorry. I sorted it.
BlueBob
shiro, your hotmail address is being rejected. Do you have an alternative address?
BlueBob
Heres my code to open the files, and which also calls the functions to read in the data. You say i should use a while loop to read up until the eof, how would i add add this? Also, is the option ==...
I'v tried what you have suggested, but it doesnt seem 2 have sorted the problem.
I think the problem is with the reading of the data from the files. The action memberRead, videoRead, and...
At the top and bottom of main() i have (respectivly)
openFiles('r');
readDataFromFile();
closeFiles('r');
and
openFiles('w');
writeDataToFile();
This sort seems to work the first time it is run, but if i run it a second time, it sorts the array in the opposite direction, and so on. Any ideas?
for (j = 0; j < i - 1; j++)
for (x = i -...
I am trying to sort an array of structures alphabetically. Can this be done?
if yes, how? I can only find sorts that organise numerically. Any help would be appreciated.
Blue Bob
I am using structures of arrays, and one of the arrays holds football teams. I want to organise the data alphabetically, and have it displayed. Can this be done?
Help. I just cant this code to work. I can enter the data into the array, and i know its there, because i can display all items in the structure of arrays, and it displays everything fine.
But...
We have been told to use bubble sort, as it is the easiest (his words, not mine).
How would i implemenet a qsort on an structure of arrays anyway?
This bubble sort isnt working for me, any ideas? Im trying to sort a structure of arrays by one variable in structure. Im trying to sort by videocat.
for (j = 0; j < i - 1; j++)
for (x = i...