![]() |
| | #1 |
| Registered User Join Date: May 2008
Posts: 61
| sequential file program nor tell me exactly how to do it. That said, I am going to mention that I am in desperate need of help, don't understand at all what I am truly doing, but will take whatever help you guys are willing to offer, and see where I can go from there. That said, this is the sequential file assignment: Code: 1. Look at the last several parts of the programming assignment.
We want to modify sequential file creation to handle the following datatype:
struct Student {
int key; /* between 100 and 999 */
char name [7]; /* makes tabs work nicely */
int test1, test2, test3;
/* values between 0 and 120 */
int hwCount; /* values between 0 and 10 */
int hwPoints; /* values between 0 and 50 */
};
Note that total is not represented anywhere in the stored records—this is required.
In order to report it, it must be computed. Total counts all test grades and homework points,
plus a 1-point bonus per HW assignment (that is, add in hwCount).
2. Create an input file of between 20 and 30 records [more if you’d like],
in key-sorted order, and create the sequential file. Make all data values correct.
3. Create a transaction file of records of the following type.
struct Transaction {
int type; /* values between 0 and 5 */
int key; /* between 100 and 999 */
int value; /* interpretation depends on value of type */
char name [7]; /* usually ignored */
};
For simplicity, there are no deletes.
4. The keys should be in sorted order, with duplicates. The interpretation is as follows:
Type = 0, insert a new record with name name and key key, and all other values 0.
key should have at least one character, that is, strlen (key) > 0.
Type = 1, 2, or 3, add value points to test. (value may be negative.)
Check for constraint on resulting test score.
Type = 4, add one assignment and value points for homework, checking the constraint.
value should be non-negative, and less than or equal 5.
Type = 5, add value points for homework, without changing hwCount.
Total hwPoints should not exceed 5 * hwCount.
Note to create and populate a new record,
you need to use one transaction of type 0, one each of types 1, 2, and 3, and several of type 4.
5. Create a program that opens both the sequential file and the transaction file for reading,
and another sequential file for writing and reading (w+). Look at the first key in each read file.
If the master key is earlier, copy the record.
If the transaction key is earlier:
If it is an insert (type = 0), create a new record.
Populate it with subsequent modify operations (type 1-5).
Copy the final record.
It is an error if a record that doesn’t exist is modified. Print an error message to stderr and continue.
If the two keys are equal:
If it is an insert, print an error message and continue.
You may check whether the names are also equal, and base your error message on that test.
Otherwise, perform the requested modification.
It is an error if the numerical conditions are violated.
Use the extreme range value (0 or max), rather than rejecting, print an error message, and continue.
6. Store a sentinel (key = 0, name = “”, scores all 0) at the end of the file,
to avoid some C/UNIX file read errors.
7. Keep track of the number of initial records, the number of transactions,
the number of errors, and the number of final records, and print the final values.
8. Reset the result file (fseek (filename, 0, SEEK_SET)).
9. Read the result file. For each record, print the key, the name, the point total,
and the percent average (based on 350 points). Finally, print the number of records processed.
note that i am trying, just a slow, slow learner.. in a fast, fast teaching teachers' class. This is the seq file that I have so far: Code: #include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct Student {
int key;
char name [7];
int test1, test2, test3;
int hwCount;
int hwPoints;
int total;
}
dummy = {-1, "", 0, 0, 0, 0},
* aStudent;
FILE * infile, * recordFile, *transFile;
int openFiles ( ) {
if ((infile = fopen ("data.txt", "r")) == NULL) {
fprintf (stderr, "Error in opening input file\n");
return 0;
}
if ((recordFile = fopen ("records.txt", "w+")) == NULL) {
fprintf (stderr, "Error in opening record file\n");
return 0;
}
if ((transFile = fopen ("transactions.txt", "w+")) == NULL) {
fprintf (stderr, "Error in opening transaction file\n");
return 0;
}
return 1;
}
void closeFiles ( ) {
fclose (infile);
fclose (recordFile);
fclose(transFile);
}
struct Student * getOneStudentFromData ( ) {
struct Student * aStudentPtr;
int theId, theTest1, theTest2, theTest3, theHwCount, theHwPoints;
char theName [20];
fscanf (inFile, "%d%s%d%d%d%d",
&theId, &theName, &theTest1, &theTest2, &theTest3,
&theHwCount, &theHwPoints);
aStudentPtr = (struct Student *) malloc (sizeof (struct Student));
aStudentPtr->key = theId;
aStudentPtr->test1 = theTest1;
aStudentPtr->test2 = theTest2;
aStudentPtr->test3 = theTest3;
aStudentPtr->hwCount = theHwCount;
aStudentPtr->hwPoints = theHwPoints;
strcpy (aStudentPtr->name, theName);
return aStudentPtr;
}
void writeRecord (struct Student * theStudentPtr) {
fwrite (theStudentPtr, sizeof (struct Student), 1, recordFile);
}
struct Transaction {
int type;
int key;
int value;
char name [7];
}
int readDataAndWriteRecords ( ) {
static int recordsSeen = 0;
struct Student * theStudentPtr;
theStudentPtr = (struct Student *) malloc (sizeof (struct Student));
do {
theStudentPtr = getOneStudentFromData ( );
recordsSeen ++;
writeRecord (theStudentPtr);
} while (theStudentPtr->key != -1);
return recordsSeen;
}
int readRecordsAndPrintData ( ) {
static int recordsSeen = 0;
struct Student * myStudentPtr;
myStudentPtr = (struct Student *) malloc (sizeof (struct Student));
do {
fread (myStudentPtr, sizeof (struct Student), 1, recordFile);
recordsSeen ++;
if (myStudentPtr->key!= -1) {
printf ("%d\t%s\t%d\t%d\t%d\t%d\n",
myStudentPtr->key,
myStudentPtr->name,
myStudentPtr->test1,
myStudentPtr->test2,
myStudentPtr->hwCount,
myStudentPtr->hwPoints);
}
} while (myStudentPtr->key != -1);
return recordsSeen;
}
int main ( ) {
int numRecords;
if (!openFiles ( )) {
return 0;
}
numRecords = 0;
numRecords = readDataAndWriteRecords ( );
printf ("%d records read from data file\n", numRecords);
fseek (recordFile, 0, SEEK_SET);
numRecords = 0;
numRecords = readRecordsAndPrintData ( );
printf ("
printf ("%d records read from record file\n", numRecords);
closeFiles ( );
}
The records file I have blank, with nothing in it at all; The data file looks like this: Code: 100 Jeff 98,76,86 8 41 101 Mark 66,51,76 4 31 102 Jenn 79,89,93 9 44 103 Chris 44,78,45 3 28 104 Matt 74,81,88 8 39 105 Dan 67,91,83 6 24 106 Dave 55,81,75 7 45 107 Rich 91,93,89 9 32 108 Michael 55,61,78 3 26 109 Tony 67,68,78 5 45 110 Rob 89,71,80 7 42 111 Sonny 78,81,89 8 15 112 Luke 91,83,75 8 24 113 April 66,79,70 6 35 114 Sheryl 89,81,85 9 50 115 Tom 79,61,90 5 33 116 Lamont 80,76,89 7 41 117 Steve 90,98,100 10 50 118 Melissa 90,78,69 8 25 219 Austin 91,45,88 7 29 0 0,0,0 0 0 Code: 3 100 5 Jeff 4 101 5 Mark 1 102 3 Jenn 2 103 5 Chris 4 104 4 Matt 3 105 3 Dan 4 106 4 Dave 5 107 14 Rich 3 108 2 Michael 0 109 Jim,120 Tony 4 110 5 Rob 2 111 -4 Sonny 3 112 4 Luke 4 113 3 April 0 114 Al,121 Sheryl 4 115 4 Tom 5 116 18 Lamont 1 117 3 Steve 2 118 1 Melissa 3 119 3 Austin 0 0 0 My hopes for what little partial credit I would get failed, and currently I am sitting on an F for the class and will stay there unless I fix this. My professors comments were: Code: ...Your sequential file program didn't even compile, and when fixed doesn't work. It never looks at transactions. ... is I truly have no idea how I would go about checking the different files initiated out of the seq file. ANY help will be greatly appreciated. Remember i don't expect you to hand it to me at all, but whatever you DO offer, I'll be greatful for. I just need direction and assistance, that's it. Thanks for the nth time. Last edited by needhelpbad; 05-19-2008 at 08:03 PM. |
| needhelpbad is offline | |
| | #2 |
| Registered User Join Date: Sep 2006
Posts: 2,517
| I can't even read your dang post without constant aggravation! Don't "break" the darn forum "table" by exceeding it's width - particularly inside code tags, where a wider font is used. Please edit your assignment portion so it all fits in one screen's width, and then you can at least have people read it without a ton of aggravation, first. |
| Adak is offline | |
| | #3 |
| Registered User Join Date: May 2008
Posts: 61
| heh my apologies, that should be a little easier to work with |
| needhelpbad is offline | |
| | #4 |
| Registered User Join Date: Sep 2006
Posts: 2,517
| This is a version of your program that will compile. Please see if it compiles on your system. Also, please go through your assignment requirements, and make a list of what requirements are met by which function or functions. I don't want to make a list of what functions work, and what functions don't - you can do it better than I can - so please make it up, and post it. Whatever code/pseudo-code I propose, you'll need to consult your lists and assignment sheet to see if it meets all the requirements. I won't do that for you, particularly since the assignment requirements are both detailed and plentiful. I'll have more time to look it over tomorrow. Any fixes to the code here THAT DOES COMPILE, please post it. Code: #include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct Student {
int key;
char name [7];
int test1, test2, test3;
int hwCount;
int hwPoints;
int total;
}
dummy = {-1, "", 0, 0, 0, 0},
* aStudent;
FILE * infile, * recordFile, *transFile;
int openFiles ( ) {
if ((infile = fopen ("data.txt", "r")) == NULL) {
fprintf (stderr, "Error in opening input file\n");
return 0;
}
if ((recordFile = fopen ("records.txt", "w+")) == NULL) {
fprintf (stderr, "Error in opening record file\n");
return 0;
}
if ((transFile = fopen ("transactions.txt", "w+")) == NULL) {
fprintf (stderr, "Error in opening transaction file\n");
return 0;
}
return 1;
}
void closeFiles ( ) {
fclose (infile);
fclose (recordFile);
fclose(transFile);
}
struct Student * getOneStudentFromData ( ) {
struct Student * aStudentPtr;
int theId, theTest1, theTest2, theTest3, theHwCount, theHwPoints;
char theName [20];
fscanf (infile, "%d%s%d%d%d%d",
&theId, &theName, &theTest1, &theTest2, &theTest3,
&theHwCount, &theHwPoints);
aStudentPtr = (struct Student *) malloc (sizeof (struct Student));
aStudentPtr->key = theId;
aStudentPtr->test1 = theTest1;
aStudentPtr->test2 = theTest2;
aStudentPtr->test3 = theTest3;
aStudentPtr->hwCount = theHwCount;
aStudentPtr->hwPoints = theHwPoints;
strcpy (aStudentPtr->name, theName);
return aStudentPtr;
}
void writeRecord (struct Student * theStudentPtr) {
fwrite (theStudentPtr, sizeof (struct Student), 1, recordFile);
}
struct Transaction {
int type;
int key;
int value;
char name [7];
};
int readDataAndWriteRecords (void) {
static int recordsSeen = 0;
struct Student * theStudentPtr;
theStudentPtr = (struct Student *) malloc (sizeof (struct Student));
do {
theStudentPtr = getOneStudentFromData ( );
recordsSeen ++;
writeRecord (theStudentPtr);
} while (theStudentPtr->key != -1);
return recordsSeen;
}
int readRecordsAndPrintData ( ) {
static int recordsSeen = 0;
struct Student * myStudentPtr;
myStudentPtr = (struct Student *) malloc (sizeof (struct Student));
do {
fread (myStudentPtr, sizeof (struct Student), 1, recordFile);
recordsSeen ++;
if (myStudentPtr->key!= -1) {
printf ("%d\t%s\t%d\t%d\t%d\t%d\n",
myStudentPtr->key,
myStudentPtr->name,
myStudentPtr->test1,
myStudentPtr->test2,
myStudentPtr->hwCount,
myStudentPtr->hwPoints);
}
} while (myStudentPtr->key != -1);
return recordsSeen;
}
int main ( ) {
int numRecords;
if (!openFiles ( )) {
return 0;
}
numRecords = 0;
numRecords = readDataAndWriteRecords ( );
printf ("%d records read from data file\n", numRecords);
fseek (recordFile, 0, SEEK_SET);
numRecords = 0;
numRecords = readRecordsAndPrintData ( );
printf ("%d records read from record file\n", numRecords);
closeFiles ( );
return 0;
}
|
| Adak is offline | |
| | #5 |
| Registered User Join Date: May 2008
Posts: 61
| just out of curiosity, what did you change that allowed this to compile? and I will look over it more now to see which functions are working and which aren't. Thanks for the help |
| needhelpbad is offline | |
| | #6 | |
| Registered User Join Date: Jan 2002 Location: Northern Virginia/Washington DC Metropolitan Area
Posts: 2,787
| Quote:
Code: FILE * infile, * recordFile, *transFile;
int openFiles ( ) {
if ((infile = fopen ("data.txt", "r")) == NULL) {
fprintf (stderr, "Error in opening input file\n");
return 0;
}
...
}
void closeFiles ( ) {
fclose (infile);
fclose (recordFile);
fclose(transFile);
}
struct Student * getOneStudentFromData ( ) {
...
fscanf (inFile, "%d%s%d%d%d%d",
&theId, &theName, &theTest1, &theTest2, &theTest3,
&theHwCount, &theHwPoints);
...
}
Code: struct Transaction {
int type;
int key;
int value;
char name [7];
};
int readDataAndWriteRecords (void) {
...
}
Code: numRecords = readRecordsAndPrintData ( );
printf ("
printf ("%d records read from record file\n", numRecords);
__________________ On two occasions I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question. --Charles Babbage, 1792-1871 09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0 Last edited by hk_mp5kpdw; 05-20-2008 at 11:12 AM. | |
| hk_mp5kpdw is offline | |
| | #7 |
| Registered User Join Date: May 2008
Posts: 61
| so here is the fixed version of the seqfile that I can come up with the fixed problems: Code: #include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct Student {
int key;
char name [7];
int test1, test2, test3;
int hwCount;
int hwPoints;
int total;
}
dummy = {-1, "", 0, 0, 0, 0},
* aStudent;
FILE * inFile, * recordFile, *transFile;
int openFiles ( ) {
if ((inFile = fopen ("data.txt", "r")) == NULL) {
fprintf (stderr, "Error in opening input file\n");
return 0;
}
if ((recordFile = fopen ("records.txt", "w+")) == NULL) {
fprintf (stderr, "Error in opening record file\n");
return 0;
}
if ((transFile = fopen ("transactions.txt", "w+")) == NULL) {
fprintf (stderr, "Error in opening transaction file\n");
return 0;
}
return 1;
}
void closeFiles ( ) {
fclose (inFile);
fclose (recordFile);
fclose(transFile);
}
struct Student * getOneStudentFromData ( ) {
struct Student * aStudentPtr;
int theId, theTest1, theTest2, theTest3, theHwCount, theHwPoints;
char theName [20];
fscanf (inFile, "%d%s%d%d%d%d",
&theId, &theName, &theTest1, &theTest2, &theTest3,
&theHwCount, &theHwPoints);
aStudentPtr = (struct Student *) malloc (sizeof (struct Student));
aStudentPtr->key = theId;
aStudentPtr->test1 = theTest1;
aStudentPtr->test2 = theTest2;
aStudentPtr->test3 = theTest3;
aStudentPtr->hwCount = theHwCount;
aStudentPtr->hwPoints = theHwPoints;
strcpy (aStudentPtr->name, theName);
return aStudentPtr;
}
void writeRecord (struct Student * theStudentPtr) {
fwrite (theStudentPtr, sizeof (struct Student), 1, recordFile);
}
struct Transaction {
int type;
int key;
int value;
char name [7];
};
int readDataAndWriteRecords ( ) {
static int recordsSeen = 0;
struct Student * theStudentPtr;
theStudentPtr = (struct Student *) malloc (sizeof (struct Student));
do {
theStudentPtr = getOneStudentFromData ( );
recordsSeen ++;
writeRecord (theStudentPtr);
} while (theStudentPtr->key != -1);
return recordsSeen;
}
int readRecordsAndPrintData ( ) {
static int recordsSeen = 0;
struct Student * myStudentPtr;
myStudentPtr = (struct Student *) malloc (sizeof (struct Student));
do {
fread (myStudentPtr, sizeof (struct Student), 1, recordFile);
recordsSeen ++;
if (myStudentPtr->key!= -1) {
printf ("%d\t%s\t%d\t%d\t%d\t%d\n",
myStudentPtr->key,
myStudentPtr->name,
myStudentPtr->test1,
myStudentPtr->test2,
myStudentPtr->hwCount,
myStudentPtr->hwPoints);
}
} while (myStudentPtr->key != -1);
return recordsSeen;
}
int main ( ) {
int numRecords;
if (!openFiles ( )) {
return 0;
}
numRecords = 0;
numRecords = readDataAndWriteRecords ( );
printf ("%d records read from data file\n", numRecords);
fseek (recordFile, 0, SEEK_SET);
numRecords = 0;
numRecords = readRecordsAndPrintData ( );
printf ("%d records read from record file\n", numRecords);
closeFiles ( );
}
obviously the close files works, for the struct of getOneStudentFromData, I think I am having an issue of connecting the pointers to the info from the data file, but not sure what to do or whats causing the issue. and with all that, i simply don't have a struct to interact with the transFile because I am not sure where to even start with it. So far I am greatly appreciative of the help though, thanks guys, really. |
| needhelpbad is offline | |
| | #8 |
| Registered User Join Date: Sep 2006
Posts: 2,517
| You have a transaction struct defined in the program. Wasn't it intended for use with the transaction file? You'll need to create an instance of that transaction struct, of course. I'm disappointed that you haven't done the bookkeeping type work for this program. I wanted you to share what each function did, to complete what part of the assignment, if any. If you're not sure what has been loaded from a file, I expect you to print the record, or field, onto the screen, and check. And not to come here and say "I'm not sure about ...<whatever>." You need to get sure, and get sure quickly. Same thing with output. You can, and should be, checking it. I need that assignment work done ASAP. That's what I use to design a program - from the top down, at first. Put the details of variables in another list, but the major things the program has to do, will be used to decide what functions we have will do what, and what other functions we still need. Put off the details, (list them, off to one side, but don't include them in the function code, for now). We want to focus on the big stuff, first). |
| Adak is offline | |
| | #9 |
| Registered User Join Date: May 2008
Posts: 61
| Code: 1. Look at the last several parts of the programming assignment.
We want to modify sequential file creation to handle the following datatype:
struct Student {
int key; /* between 100 and 999 */
char name [7]; /* makes tabs work nicely */
int test1, test2, test3;
/* values between 0 and 120 */
int hwCount; /* values between 0 and 10 */
int hwPoints; /* values between 0 and 50 */
};
Note that total is not represented anywhere in the stored records—this is required.
In order to report it, it must be computed. Total counts all test grades and homework points,
plus a 1-point bonus per HW assignment (that is, add in hwCount).
struct Student { int key; char name [7]; int test1, test2, test3; int hwCount; int hwPoints; int total; } dummy = {-1, "", 0, 0, 0, 0}, * aStudent; Code: 2. Create an input file of between 20 and 30 records [more if you’d like], in key-sorted order, and create the sequential file. Make all data values correct. Code: 100 Jeff 98,76,86 8 41 101 Mark 66,51,76 4 31 102 Jenn 79,89,93 9 44 103 Chris 44,78,45 3 28 104 Matt 74,81,88 8 39 105 Dan 67,91,83 6 24 106 Dave 55,81,75 7 45 107 Rich 91,93,89 9 32 108 Michael 55,61,78 3 26 109 Tony 67,68,78 5 45 110 Rob 89,71,80 7 42 111 Sonny 78,81,89 8 15 112 Luke 91,83,75 8 24 113 April 66,79,70 6 35 114 Sheryl 89,81,85 9 50 115 Tom 79,61,90 5 33 116 Lamont 80,76,89 7 41 117 Steve 90,98,100 10 50 118 Melissa 90,78,69 8 25 219 Austin 91,45,88 7 29 0 0,0,0 0 0 Code: 3. Create a transaction file of records of the following type.
struct Transaction {
int type; /* values between 0 and 5 */
int key; /* between 100 and 999 */
int value; /* interpretation depends on value of type */
char name [7]; /* usually ignored */
};
For simplicity, there are no deletes.
Code: 4. The keys should be in sorted order, with duplicates. The interpretation is as follows: Type = 0, insert a new record with name name and key key, and all other values 0. key should have at least one character, that is, strlen (key) > 0. Type = 1, 2, or 3, add value points to test. (value may be negative.) Check for constraint on resulting test score. Type = 4, add one assignment and value points for homework, checking the constraint. value should be non-negative, and less than or equal 5. Type = 5, add value points for homework, without changing hwCount. Total hwPoints should not exceed 5 * hwCount. Note to create and populate a new record, you need to use one transaction of type 0, one each of types 1, 2, and 3, and several of type 4. Code: 5. Create a program that opens both the sequential file and the transaction file for reading, and another sequential file for writing and reading (w+). Look at the first key in each read file. Code: If the master key is earlier, copy the record. If the transaction key is earlier: If it is an insert (type = 0), create a new record. Populate it with subsequent modify operations (type 1-5). Copy the final record. It is an error if a record that doesn’t exist is modified. Print an error message to stderr and continue. If the two keys are equal: If it is an insert, print an error message and continue. You may check whether the names are also equal, and base your error message on that test. Otherwise, perform the requested modification. It is an error if the numerical conditions are violated. Use the extreme range value (0 or max), rather than rejecting, print an error message, and continue. Code: 6. Store a sentinel (key = 0, name = “”, scores all 0) at the end of the file, to avoid some C/UNIX file read errors. Code: 7. Keep track of the number of initial records, the number of transactions, the number of errors, and the number of final records, and print the final values. Code: int main ( ) {
int numRecords;
if (!openFiles ( )) {
return 0;
}
numRecords = 0;
numRecords = readDataAndWriteRecords ( );
printf ("%d records read from data file\n", numRecords);
fseek (recordFile, 0, SEEK_SET);
numRecords = 0;
numRecords = readRecordsAndPrintData ( );
printf ("%d records read from record file\n", numRecords);
closeFiles ( );
}
Code: 8. Reset the result file (fseek (filename, 0, SEEK_SET)). Code: 9. Read the result file. For each record, print the key, the name, the point total, and the percent average (based on 350 points). Finally, print the number of records processed. Code: int readRecordsAndPrintData ( ) {
static int recordsSeen = 0;
struct Student * myStudentPtr;
myStudentPtr = (struct Student *) malloc (sizeof (struct Student));
do {
fread (myStudentPtr, sizeof (struct Student), 1, recordFile);
recordsSeen ++;
if (myStudentPtr->key!= -1) {
printf ("%d\t%s\t%d\t%d\t%d\t%d\n",
myStudentPtr->key,
myStudentPtr->name,
myStudentPtr->test1,
myStudentPtr->test2,
myStudentPtr->hwCount,
myStudentPtr->hwPoints);
}
} while (myStudentPtr->key != -1);
return recordsSeen;
}
I apologize ahead of time, I am sure with all these code boxes, it may be a little hard to follow or just look completely stupid in general, but I tried to do what you asked. //continued thanks for all of this. |
| needhelpbad is offline | |
| | #10 |
| Registered User Join Date: Sep 2006
Posts: 2,517
| Change the names which have 7 letters, like "Michael", to something shorter, maybe "Mike". Reason is that there's no room for an end of string char: '\0' to elevate the name char's into a string. clear the page first with: Code: for(i = 0; i < 45; i++)
putchar('\n');
I mis-understood the assignment about transaction "type". I thought it was to work interactively, and would need a menu. That is not the case. Type in this case, does not mean "hitting keys on the keyboard". Last edited by Adak; 05-21-2008 at 08:13 AM. |
| Adak is offline | |
| | #11 | |
| Kernel hacker Join Date: Jul 2007 Location: Farncombe, Surrey, England
Posts: 15,686
| Quote:
-- Mats
__________________ Compilers can produce warnings - make the compiler programmers happy: Use them! Please don't PM me for help - and no, I don't do help over instant messengers. | |
| matsp is offline | |
| | #12 |
| Registered User Join Date: Sep 2006
Posts: 2,517
| I'm glad you're following this thread, Mats. The names array must be kept at 7, according to the assignment, though. |
| Adak is offline | |
| | #13 | |
| Kernel hacker Join Date: Jul 2007 Location: Farncombe, Surrey, England
Posts: 15,686
| Quote:
-- Mats
__________________ Compilers can produce warnings - make the compiler programmers happy: Use them! Please don't PM me for help - and no, I don't do help over instant messengers. | |
| matsp is offline | |
| | #14 |
| Registered User Join Date: May 2008
Posts: 61
| okay so i changed all the problematic names in the data.txt to be 6 letters or less to allow the final zero bit for the string and is this how I am supposed to implement the clear page coding? Code: struct Transaction {
int type;
int key;
int value;
char name [7];
for(i = 0; i < 45; i++)
putchar('\n');
};
|
| needhelpbad is offline | |
| | #15 | |
| Kernel hacker Join Date: Jul 2007 Location: Farncombe, Surrey, England
Posts: 15,686
| Quote:
-- Mats
__________________ Compilers can produce warnings - make the compiler programmers happy: Use them! Please don't PM me for help - and no, I don't do help over instant messengers. | |
| matsp is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Memory Address | kevinawad | C++ Programming | 18 | 10-19-2008 10:27 AM |
| sequential file help plz | dutrachr | C Programming | 4 | 04-18-2006 11:41 AM |
| Encryption program | zeiffelz | C Programming | 1 | 06-15-2005 03:39 AM |
| fputs and sequential file | sballew | C Programming | 5 | 11-11-2001 04:48 PM |
| My program, anyhelp | @licomb | C Programming | 14 | 08-14-2001 10:04 PM |