Thread: seek data

Page 2 of 2 First 12
  • Jump to page:
    #16
  1. No Profile Picture
    Offensive Member
    Devshed Novice (500 - 999 posts)

    Join Date
    Oct 2002
    Location
    in the perfect world
    Posts
    622
    Rep Power
    27
    look at the string functions like

    strstr() (or lstrstr() )
    strcmp() (or lstrcmp() )

    ect.

    Post some code and we will correct.



    It may be better to write the file in binary. Unless you want to be able to read the actual file (in notepad ect)

    In binary you can create a structure.
    Then you can read and write the file using the structure. Much simpler than a text file as the size of each record is constant (which is not true for a text file).
    The essence of Christianity is told us in the Garden of Eden history. The fruit that was forbidden was on the Tree of Knowledge. The subtext is, All the suffering you have is because you wanted to find out what was going on. You could be in the Garden of Eden if you had just kept your f***ing mouth shut and hadn't asked any questions.

    Frank Zappa
  2. #17
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Posts
    14
    Rep Power
    0
    Originally posted by TechNoFear
    look at the string functions like

    strstr() (or lstrstr() )
    strcmp() (or lstrcmp() )

    ect.

    Post some code and we will correct.

    Hi TechNoFear ^_^
    yeah...thanks a lot...I have solved it...
    I use strcmp to compare the string :)
    but now, I have another problem....
    it's the switch case...

    while (choice != 4){
    switch (choice)
    case 1:

    while ( fscanf(filePtr, "%s %s %s", &my_data.gureiI_id, &my_data.fans_id, &my_data.height) != EOF)
    {
    strcmp( my_data.gurei_id, "HAHA");
    printf("Hello_HAHA\n");
    }
    break;


    case 2:
    printf("Hello_HIHI\n");
    break;
    when I disabled case 2, the program can run very well, but once i enable the case 2...when i compile that time, an error pops up saying that it is an illegal case...
    do you know why is this happening?

    thanks
  4. #18
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Posts
    14
    Rep Power
    0
    can’t we use do while inside case?
  6. #19
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2002
    Location
    Flint, MI
    Posts
    328
    Rep Power
    12
    It's best not to do very much inside of a switch statement other than jump to another portion of the program. I'm not sure what the reasons are, but if you ever step through a program's execution while it's in a switch statement, you'll see it jumping around a bit. Better to call a function that will do what you want.
    Clay Dowling
    Lazarus Notes
    Articles and commentary on web development
    http://www.lazarusid.com/notes/
Page 2 of 2 First 12
  • Jump to page:

IMN logo majestic logo threadwatch logo seochat tools logo