Search:

Type: Posts; User: usernameisvalid

Search: Search took 0.00 seconds.

  1. Replies
    1
    Views
    794

    File Stream and string extraction

    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
  2. Replies
    22
    Views
    2,966

    Input scans in to an integer value. If I were...

    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.
  3. Replies
    22
    Views
    2,966

    There's something wrong with my switch statement...

    There's something wrong with my switch statement now... It only executes commands 2 and 3 successfully.



    switch(command)
    {
    case 0:
    add_class();
    break;
    ...
  4. Replies
    22
    Views
    2,966

    I got it. I moved the increment outside of my if...

    I got it. I moved the increment outside of my if statement and that fixed it.
  5. Replies
    22
    Views
    2,966

    while((fgets(buffer, LEN, fp_id) !=...

    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,...
  6. Replies
    22
    Views
    2,966

    Ok, I want to make this code run as smoothly as...

    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...
  7. Replies
    22
    Views
    2,966

    I went a slightly different route reading in...

    I went a slightly different route reading in character by character.



    else
    {
    while((ch = fgetc(fp_schedule)) != EOF)
    {
    if(isdigit(ch))
    {
  8. Replies
    22
    Views
    2,966

    Unfortunately, I have to use linked lists. I'm...

    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...
  9. Replies
    22
    Views
    2,966

    For purposes of this code, I am using linked...

    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...
  10. Replies
    22
    Views
    2,966

    I have an idea. while(ch =...

    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...
  11. Replies
    22
    Views
    2,966

    Ah, I see! The structs need to have file scope...

    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.
  12. Replies
    22
    Views
    2,966

    Input program with structures

    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...
  13. Replies
    14
    Views
    6,187

    In the read text function: int...

    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))...
  14. Replies
    14
    Views
    6,187

    else if(in_word ==1) { ...

    else if(in_word ==1)
    {
    textArray[i][j] = '\0';
    i++;
    j = 0;
    in_word = 0;
    }
    }
    ...
  15. Replies
    14
    Views
    6,187

    The function works and prints out the characters...

    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...
  16. Replies
    14
    Views
    6,187

    void read_text(FILE *fp1, char (*textArray)[21],...

    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...
  17. Replies
    14
    Views
    6,187

    Problem with I/O program

    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,...
  18. Replies
    5
    Views
    4,381

    Cool, it validates colors correctly now....

    Cool, it validates colors correctly now. CommonTater, you are a boss. Thank you.
  19. Replies
    5
    Views
    4,381

    Help with a resistor decoder

    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...
Results 1 to 19 of 19