Search:

Type: Posts; User: Raen

Search: Search took 0.01 seconds.

  1. Using strtok to fill a structure from a text file?

    Hi, I have a text file with a list that reads like this: Last name, First name, Grade with the names being strings and the grades being integers. I need to put this list into a structure so that I...
  2. Replies
    6
    Views
    3,501

    That worked! Thank you so much! The exact error...

    That worked! Thank you so much! The exact error message had been "(.text+0x7b): Undefined reference to 'tan'."

    For future reference, what does the -lm do? When is it necessary to use it?
  3. Replies
    6
    Views
    3,501

    Declaring trig functions?

    Hi. My teacher has given my class this assignment:



    I wrote this code (sorry about the weird tabbing, xming wouldn't let me copy so I had to take it from notepad):


    #include <stdio.h>...
  4. Replies
    1
    Views
    1,193

    Finding and replacing substrings

    Hi. Our C professor gave us the following problem:



    I wrote a code I think will work, but for some reason Putty and TeraTerm are both hating my computer tonight so I can't try it. I'll have...
  5. Replies
    11
    Views
    14,138

    rags_to_riches, here's my entire code: ...

    rags_to_riches, here's my entire code:


    #include <stdio.h>
    #include <stdlib.h>

    main() {

    FILE *fp1, *fp2, *fp3;
    char str[80];
  6. Replies
    11
    Views
    14,138

    Would fprintf(fp1, "%s\n", str); be...

    Would


    fprintf(fp1, "%s\n", str);

    be correct?
  7. Replies
    11
    Views
    14,138

    I'm still not getting it to work. When I try to...

    I'm still not getting it to work. When I try to compile, I get the error "warning: passing argument 1 of fprintf from incompatible pointer type" for the lines which read


    fprintf("%s\n", str);
    ...
  8. Replies
    11
    Views
    14,138

    Would it be while(fscanf(fp3, "%s",...

    Would it be


    while(fscanf(fp3, "%s", array[i])!=NULL) {
    i++;
    }

    ?

    Sorry if I seem completely clueless, I really don't understand most of what our professor does so a lot of my programming...
  9. Replies
    11
    Views
    14,138

    Oh, thank you, I didn't notice that. Were there...

    Oh, thank you, I didn't notice that. Were there any other glaring errors?

    I also think I came up with a way to write the file to an array, since I didn't understand the strtok explanations I...
  10. Replies
    11
    Views
    14,138

    Writing a text file to an array?

    Hi, I'm very new to programming and am taking an entry-level course in C. One of the homework problems we have is to take two text files, merge them into a third file, and sort the file...
Results 1 to 10 of 10