Thread: Struct and file problem!!! urgent

  1. #1
    Registered User
    Join Date
    Mar 2009
    Posts
    10

    Struct and file problem!!! urgent

    I am writing a program that refuses to work. I use fwrite to write the struct to a file in main. Everything seems to write properly. However I can't seem to read the info back from the file properly. All the members that were read and assigned in main are working however whenever i pass the struct to functions to read or assign specific members, those members are not able to be read properly from the file.

    Please help!!!

    I am using windows vista home promium and borland 5.02

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    You shouldn't reopen the same file inside another function (especially if you want it to pick up reading where the other function left off); if you need to pass a file around, then pass it in as a FILE* parameter to the function.

  3. #3
    Registered User
    Join Date
    Mar 2009
    Posts
    10

    Thanks tabstop

    I am going to try that in a little while and let u know how it worked out.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. memory issue
    By t014y in forum C Programming
    Replies: 2
    Last Post: 02-21-2009, 12:37 AM
  2. Replies: 16
    Last Post: 10-29-2006, 05:04 AM
  3. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  4. Replies: 3
    Last Post: 03-04-2005, 02:46 PM
  5. Contest Results - May 27, 2002
    By ygfperson in forum A Brief History of Cprogramming.com
    Replies: 18
    Last Post: 06-18-2002, 01:27 PM