Thread: Having a hard time understanding FILES!

  1. #16
    Registered User
    Join Date
    Mar 2005
    Posts
    140
    The only place you ever try to write to the file is in view_stud.
    It looks like you are trying to rewrite the file to itself. Why?
    Having the same file open for reading and writing is not good.

    It also looks like you're trying to treat the file as both binary and plain text at the same time.
    You may want to start over and get a simple example of writing and reading from a file working.

    You ask for all the student info, but never do anything with it.

    Your goto just creates an infinite loop, what's wrong with
    Code:
    while(1) {
      all your code
    }
    Last edited by spydoor; 10-02-2006 at 12:00 PM.

  2. #17
    ComSci newbie...ICS kid
    Join Date
    Jul 2006
    Location
    PHILIPPINES!!!
    Posts
    38
    @spydoor
    Oh... Okay... I'll try that. But wait a minute, you mean I have to start over???

    TO ALL THOSE WITH FRIENDSTER, ADD ME!

    i'm [email protected]
    a newbie in the field of Computer Science!! Pray for all the student's success!

  3. #18
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >But wait a minute, you mean I have to start over???
    Sometimes the best solution is to start over. Would you rather have a crappy program patched into working, or a program that's well designed from the start? It's important to realize that the quality of your design is directly proportional to how easy it is to implement. A better design is easier to create and maintain than a poor design.
    My best code is written with the delete key.

  4. #19
    ComSci newbie...ICS kid
    Join Date
    Jul 2006
    Location
    PHILIPPINES!!!
    Posts
    38
    hay.... Thanks for the advice..

    TO ALL THOSE WITH FRIENDSTER, ADD ME!

    i'm [email protected]
    a newbie in the field of Computer Science!! Pray for all the student's success!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. string methods hard time
    By Micko in forum C++ Programming
    Replies: 2
    Last Post: 08-07-2006, 10:00 AM
  2. *.cpp and *.h files understanding
    By ElastoManiac in forum C++ Programming
    Replies: 4
    Last Post: 06-11-2006, 04:45 AM
  3. Linking header files, Source files and main program(Accel. C++)
    By Daniel Primed in forum C++ Programming
    Replies: 3
    Last Post: 01-17-2006, 11:46 AM
  4. The space time continueimnms mm... (rant)
    By Jeremy G in forum A Brief History of Cprogramming.com
    Replies: 32
    Last Post: 06-27-2004, 01:21 PM
  5. Is this really true or it's just science fiction?
    By Nutshell in forum A Brief History of Cprogramming.com
    Replies: 145
    Last Post: 04-09-2002, 06:17 PM