Results 1 to 4 of 4

Thread: Text Files & Coding

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2013
    Posts
    62

    Text Files & Coding

    Hi I need help with this task:
    Create a user defined type of student information (name, age, contact number, gender). Create an array of your type to store 5 records (get user to populate this via the console). Then, write the contents to file in BINARY format.

    So far I have a basic algorithm and a little bit of code which isn't even worth showing. Here's my algorithm. If anyone could help it would be brilliant!

    OPEN File
    SET Structure As Student
    strStudentName
    intStudentAge
    intStudentContact
    strStudent Gender
    SET Array = arrStudent(4)
    For i = 0 to 4
    GET StudentName
    GET StudentAge
    GET StudentContact
    GET StudentGender

    WRITE to file

    Next

    Thanks a lot!

  2. #2
    Fanatic Member AceInfinity's Avatar
    Join Date
    May 2011
    Posts
    696

    Re: Text Files & Coding

    Is this just pseudo code? Or, do you have something written so far? Sounds like a homework project, so i'm not just going to post you a solution. What do you need help with? You haven't asked a question so my first impression was that you just wanted someone else to write it for you unfortunately.

    ~Ace
    <<<------------
    Improving Managed Code Performance | .NET Application Performance
    < Please if this helped you out. Any kind of thanks is gladly appreciated >


    .NET Programming (2012 - 2018)
    ®Crestron - DMC-T Certified Programmer | Software Developer
    <<<------------

  3. #3
    Frenzied Member IanRyder's Avatar
    Join Date
    Jan 2013
    Location
    Healing, UK
    Posts
    1,232

    Re: Text Files & Coding

    Hi,

    I agree with AceInfinity so I will only help you to fix your own posted code examples. That said, there are four main principals that you need to complete and design for your project to work. They are:-

    1) Creating a custom class / structure. See here:-

    http://msdn.microsoft.com/en-gb/library/ms973814.aspx
    http://www.codeproject.com/Articles/...ures-in-VB-NET

    2) Holding your information in an array. See here:-

    http://msdn.microsoft.com/en-gb/libr...reatingAnArray
    http://msdn.microsoft.com/en-gb/libr...v=vs.100).aspx

    3) Using a loop to get the information you need. See here:-

    http://msdn.microsoft.com/en-us/libr...v=vs.100).aspx

    4) Saving your information in a Binary file. See here:-

    http://msdn.microsoft.com/en-us/libr...code-snippet-1

    Hope that helps.

    Cheers,

    Ian

  4. #4

    Thread Starter
    Member
    Join Date
    Jan 2013
    Posts
    62

    Re: Text Files & Coding

    Hi it's not a homework task, I'm practicing some solutions at the moment. I don't want the code, I just wanted to know how to go about doing it. My algorithm gives some kind of indication however I'm completely baffled when it comes to the code.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width