Struct and file problem!!! urgent

This is a discussion on Struct and file problem!!! urgent within the C Programming forums, part of the General Programming Boards category; I am writing a program that refuses to work. I use fwrite to write the struct to a file in ...

  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
    Attached Files Attached Files

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    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, 07: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, 02:27 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21