Search:

Type: Posts; User: kensing

Search: Search took 0.01 seconds.

  1. As for the string to int problem, it hit me that...

    As for the string to int problem, it hit me that I could just scan it as a double instead, multiply by 1000, and then treat them with %.0lf..

    Do you think my teacher might think that this is a bit...
  2. Replies
    14
    Views
    1,745

    How can I create a new array that contains the...

    How can I create a new array that contains the different values of data[lineNo].value1?

    For example, I have data[1].value1 = 50 and data[2].value1 = 50 and data[3].value1 = 100

    I then want to...
  3. I solved the problem with the above code :)

    I solved the problem with the above code :)
  4. This is what I'm trying to do: for(linjeNr...

    This is what I'm trying to do:



    for(linjeNr = 1; linjeNr < LINJER_MAX && (data[linjeNr].hold1score + data[linjeNr].hold2score) >= 5; linjeNr++)
    {
    printf("%s\n",...
  5. Ignoring invalid characters how? Another major...

    Ignoring invalid characters how?

    Another major problem, which is underlying most of my other problems, is how to reference this array that I've built up:



    struct kampdata
    {
    char...
  6. Actually, yea, loads of warnings.. I should...

    Actually, yea, loads of warnings.. I should compile more often. I'll start from the beginning I guess, since this whole array subscript thing seems really tricky to me.
  7. Since I'm taking these values from an array of...

    Since I'm taking these values from an array of strings, I should of course copy and parse them into an array of int's, so it would look more like this:



    char new_string[lineNo];
    int...
  8. I thought your post made enough sense that I...

    I thought your post made enough sense that I would be able to code it, but after moving on and returning to this problem several times, I'm still lost..

    I tried implementing


    char...
  9. How to convert string containing numbers (separated by chars) to an int?

    I've read a little bit about atoi() and some similar functions, but I can't get them working to resolve my particular problem..

    I've scanned in some numbers in the thousands, and these have a dot...
  10. Replies
    14
    Views
    1,745

    Thank you - your responses have been very useful!...

    Thank you - your responses have been very useful! :)
  11. Replies
    14
    Views
    1,745

    I got it all working now :) Thus my last...

    I got it all working now :)

    Thus my last question related to this thread is this:
    How do I choose to skip a piece of information in the file I'm reading from, using sscanf? For example, if my...
  12. Replies
    14
    Views
    1,745

    Of course, bingo :) But how to access for...

    Of course, bingo :)

    But how to access for example data.value1 in line 1?
  13. Replies
    14
    Views
    1,745

    I get the following error messages ...

    I get the following error messages

    test2.c:25:1: warning: data definition has no type or storage class
    test2.c:25:1: error: conflicting types for ‘file’
    test2.c:23:7: note: previous declaration...
  14. Replies
    14
    Views
    1,745

    I'm having trouble figuring out how to parse to...

    I'm having trouble figuring out how to parse to data[lineNo] with sscanf. You don't have to do it for me, if you could just refer me to some explanatory text on the subject


    Thank you in advance!
  15. Replies
    14
    Views
    1,745

    Thank you for the response, it seems very...

    Thank you for the response, it seems very helpful, I'll look it over right now :)
  16. Replies
    14
    Views
    1,745

    Input from file using arrays or struct?

    I want to write a program that takes values from a text file, assigns them to different variables and then does different computations on those variables..

    I've tried using fscanf/fgets and...
Results 1 to 16 of 16