Hi,
I am currently trying to read in a file that takes in the input in the following form.
HANK>25 BOB>31 AL>54
BILL>41 ABE>63 JEFF>50
Type: Posts; User: usernameisvalid
Hi,
I am currently trying to read in a file that takes in the input in the following form.
HANK>25 BOB>31 AL>54
BILL>41 ABE>63 JEFF>50
Input scans in to an integer value. If I were doing something weird with my input wouldn't it cause the default case to print instead of terminating?
Nevermind. I fixed the bug somehow.
There's something wrong with my switch statement now... It only executes commands 2 and 3 successfully.
switch(command)
{
case 0:
add_class();
break;
...
I got it. I moved the increment outside of my if statement and that fixed it.
while((fgets(buffer, LEN, fp_id) != NULL)&&(line_num < NUM_STUDENTS))
{
if(sscanf(buffer, "%d %s %s %s\n", &studentArray[line_num].student_id, &studentArray[line_num].last_name,...
Ok, I want to make this code run as smoothly as possible so I will look more into fgets/sscanf when I wake up. Thank you for your help so far.
Before I go, I do have one more question.
In the...
I went a slightly different route reading in character by character.
else
{
while((ch = fgetc(fp_schedule)) != EOF)
{
if(isdigit(ch))
{
Unfortunately, I have to use linked lists. I'm currently working on the part that reads in the text file for the first fopen statement. I understand what I want it to do, but am having a difficult...
For purposes of this code, I am using linked lists. I am taking the data in student info and linking the class info to the student info. For example, if a student is enrolled in a class, I want to...
I have an idea.
while(ch = fgetc(fp_schedule) != EOF)
Since I have the ctype.h header I have access to isalpha(), isdigit(), and other wonderful functions like that. The problem is there...
Ah, I see! The structs need to have file scope rather than block scope so I can pass them to the other functions. Thanks for the catch.
I am writing a code that is a menu driven program that takes the input several files, arranges them into structures, and links those structures.
I'm having some difficulty scanning in to the...
In the read text function:
int read_text(FILE *fp1, char (*textArray)[21], char (*wordArray)[21])
{
int i = 0, j = 0, in_word = 0, h = 0;
char ch;
while((ch = fgetc(fp1))...
else if(in_word ==1)
{
textArray[i][j] = '\0';
i++;
j = 0;
in_word = 0;
}
}
...
The function works and prints out the characters correctly. However, I am trying to pass the array of characters over to another array to compare the two, using strncmp to find unique words. When I...
void read_text(FILE *fp1, char (*textArray)[21], char (*wordArray)[21]);
void write_text(FILE *fp2, char (*textArray)[21]);
void write_max_min(FILE *fp2, char (*wordArray)[21]);
I tried...
I am in the process of writing a program that takes the input of a text file, recognizes all the unique words, and prints them into another text file.
For some reason, when it prints a long list,...
Cool, it validates colors correctly now. CommonTater, you are a boss. Thank you.
I am currently working a program that is supposed to decode a six banded resistor, but every time I run the program it tells me that I have entered an invalid color, and the compiler also gives me a...