How to solve this trouble ? Please help me !

Hi everyone ! I'm fresher in c and c++. I'm having a trouble when I add new data into vector / list . I have a method like :
void List(vector<Student> &result)
ifstream list(saveurl, ios::in | ios::binary);
if (list.is_open())
Student st;
while (!list.eof())
if (list.read((char*)&st, sizeof(Student)))
result.push_back(st);
list.close();
First-chance exception at 0x5E84DF58 (msvcp120d.dll) in Student.exe: 0xC0000005: Access violation reading location 0x010FAA4C.
If there is a handler for this exception, the program may be safely continued.
what can I do now ? any suggestions for me ?

On 17/03/2015 20:31, "Tran Hoang Duc" wrote:
as shown below is how is the Student class defined .
struct DateTime
int day,month,year;
class Student
private :
__int64 RollNo;
string StudentName, Course, FatherName,Address,Country;
DateTime DateofBirth;
is it right ?
Perfect, as I suspected :)
Your Student class definition is just fine.
The problem is how you serialize that to/from files.
Since you have non-POD types like std::string as Student data members, you can't just dump your Student internal bytes to disk and read them back to disk.
This won't work, because for example std::string has pointers inside, and the values of those pointers (memory addresses) are meaningless when you write them to file and later load them from file, as just raw bytes, like in this code showed above in
this thread:
Student st;
while(list.read((char*)&st, sizeof(Student)))
 You have to think how to write your Student class to files.
You can use XML, JSON, or even simple comma separated values text files.
Even if you use some custom binary format for your Student instances, you should pay attention to properly write the text stored in your strings to files, and read that back into std::string data members.
 Giovanni

Similar Messages

  • My iphone 4 is acting like crap right i can't even restore it everytime i try to reboot it my iphone freezes at the apple logo it is ******* to the point where i just want to smash it how do i solve this problem please help?

    my iphone 4 is acting like crap right i can't even restore it everytime i try to reboot it my iphone freezes at the apple logo it is ******* me off to the point where i just want to smash it how do i solve this problem please help?

    Don't worry, just follow these steps to fix iPhone stuck on Apple logo
    => First of all Start your Computer and then connect with Internet connection, now Download the latest version of the iTunes application
    => Now install the iTunes application in your System and connect your Device with computer via Data cable
    => Now connect your Device with iTunes application and then Tab on summary option, see in the left side bar of iTunes
    => Now Select restore option from iTunes and then confirm the Restore Message for better results. After this unplug your Device and Restart it
    I hope that will surely
    Thank you...

  • Hi .. my iPad 4 with iso 7.0.3 he is restarting himself ... How can i solve this problem please help me

    Hi .. my iPad 4 with iso 7.0.3 he is restarting himself ... How can i solve this problem please help me

    Standard troubleshooting...
    1. Try a Restart by pressing the sleep/lock button until you see the slider.  Slide to power off.  Restart by pressing the sleep/lock button until you see the Apple logo.
    2. Try a Reset by pressing the home and sleep buttons until you see the Apple logo. Takes about 5-15 secs of button holding and you won't lose any data or settings.
    3. Remove apps from Recently Used list...
    - From any Home Screen, double tap the home button to bring up the Recents List
    - Swipe up on the app preview card to remove it from the list
    - Press the home button when done.
    4. If still a problem restore with your backup.
    5. If still a problem restore as new, i.e. without your backup. See how it runs with nothing synced to it.
    6. If still a problem, it's likely a hardware issue.

  • Hi my iphone 4 is disabled how can solve this problem? help me please

    hi my iphone 4 is disabled how can solve this problem? help me please

    What do you mean by "disabled"? Disabled by entering the wrong passcode? If so, you'll have to force the phone into recovery mode & restore it to get it working again & remove the passcode:
    Turn your phone off, then force it into recovery mode & restore it:
    Leave the USB cable connected to your computer, but NOT your phone, iTunes running, press & hold the home button while connecting the USB cable to your dock connector, continue holding the home button until you see “Connect to iTunes” on the screen. You may now release the home button. iTunes should now display that it has detected your phone in recovery mode, if not quit and reopen iTunes. If you still don’t see the recovery message repeat these steps again. iTunes will give you the option to restore from a backup or set up as new.

  • Can Any one tell me. System considering the Sales District also in Delivery Split which is not in standard. How to resolve this. Please help me

       Hi
    Can Any one tell me. System considering the Sales District also in Delivery Split which is not in standard. How to resolve this. Please help me

    Dear Srikanth,
    I am not sure, if my answer will satisfy you, but anyway I will try:
    Field Sales District is technically called BZIRK. In delivery structure is this field located in header (table LIKP), what cause split, if origin document (Sales Order) has different Sales District in some positions. This is standard program behavior. Basically it shouldn't happen, as value is taken from customer master (Sold-to Party) and copied to header and items of sales document. But user can manually changer for particular items.
    Well, to solve situation you have few ways:
    1. Do not allow users to change value on items - can be managed by organizational decision or by authorization concept.
    2. If there is a reason to have different Sales District in items, then it can be managed in in routines for copy control between sales and delivery documents (delete value of BZIRK for all items for instance). But then will be this information lost for further usage. It seems to me to invoice is value copied directly from sales order (field VBRP-BZIRK_AUFT) then it mustn't be a critical for analyses.
    3. Your situation also can happen if you wants to collect more sales documents to one delivery. In this case can be that Sales District is different for same customer in different sales order (even seems to be little bit strange). Then solution from point 2 can help as well, I believe.
    Best Regards
    Arnost

  • I can't forcequit firefox and shutdown my computer, nor can I open up any other programs or applications. Does anyone know how to fix this? please help this poor soul.

    I can't forcequit firefox and shutdown my computer, nor can I open up any other programs or applications. Does anyone know how to fix this? please help this poor soul.

    You can force quit applications
    >Force quit
    if that does not work you can force quit a computer shut down by hold the power button for an extended period.

  • After upgrading my iPhone 5 to iOS 7 iTunes will not stay open once the app launches...does anyone know how to fix this? Please Help :)

    After upgrading my iPhone 5 to iOS 7 iTunes will not stay open once the app launches...does anyone know how to fix this? Please Help :)

    I have exactly the same problem. I too have tried everything that's been suggested, but still not working. Don't really what to do next? I have an iPhone 4S.

  • How to solve this problem, pls help when I try to see remote camera system from home."Dual streaming is required for HTML viewing"

    How to solve this problem, pls help when, I try to see remote camera system(spec dvr) from home. The Error I get is "Dual streaming is required for HTML viewing"

    I had the same probelm and found that the problem lies with 64bit programs such as safari and microsoft internet explorer. I have resolved the issue on my PC based server by using a 32 bit ie and same on my mac by using the same running windows under parallels.
    So far the problem with the 64 bit side of it is still to be resolved.
    Hope this helps and gets you guys up and running until suchtime a 64 bit solution is found.
    Craig

  • HT5622 my apple id is not working when i sign in from my laptop it works but when i sign in from my iphone4 then its not working it gives the message of "your aapleid or password is incorrect"? how can i solve this problem please help

    my apple id is not working when i sign in from my laptop it works but when i sign in from my iphone4 then its not working it gives the message of "your aapleid or password is incorrect"? how can i solve this problem please help

    Hey nocillado,
    Thanks for using Apple Support Communities.
    It sounds like you have 2 things you want to address. These articles can help you use iCloud with your existing Apple ID.
    Get help activating your iPhone
    http://support.apple.com/kb/ts3424
    Using your Apple ID for Apple services
    http://support.apple.com/kb/ht4895
    Using the same Apple ID for Store purchases and iCloud (recommended)
    Have a nice day,
    Mario

  • My 1st gen ipod touch has N/A in the WI-FI option can anyone tell me how to solve this issue please.

    My 1st gen ipod touch has N/A in the option menu for wireless, can anyone help solve this issue please???

    iOS: Wi-Fi or Bluetooth settings grayed out or dim
    One user reported that placing the iPod in the freezer fixed the problem.
    If not successful, an appointment at the Genius Bar of an Apple store is usually in order.
    Apple Retail Store - Genius Bar

  • I WOULD LIKE TO DELETE MY ACCOUNT OR SOLVE THIS TROUBLE PLEASE SEE THIS

    VERY URGENT (MY EMAIL IS PLENTY OF THESE QUESTIONS
    This is for the administrator(s)
    I Am receiving from your forum site many of THESE:
    aemme,
    You are watching the category "System Management and Integration", which was updated Nov 11, 2010 4:32:18 AM by Lichti:
    <http://forums.oracle.com/forums/category.jspa?categoryID=201>
    or
    <Data Integrator
    or
    <Use Oracle DB user function
    For your convenience, the new message is included below:
    I would like to delete my account or solve the problem in another way, as you like.
    I can't delete my accountr from the control panel, I don't know how to do it.
    PLEASE HELP

    Yes now the problem seems to be solved.
    But really this morning my email account was plenty of these ...questions.
    Be careful because....privacy ... and so on...
    A last question, before I was used to enter into Database >> SQL and PL/SQL how can I get there???
    :)))))))))))))))))

  • I'm not sure how to explain this but PLEASE HELP! ...

    okay so I'm not quite sure if anyone is going to understand what I'm talking about...
    But for some reason when someone adds me to skype (sends me a request) it says "Hi, White Asian!... so and so wants to add you.. blahblah etc." It says something other than my current user name, or my current display name, or my first and last name. I have know idea why it says this. I've had skype for a long time now and several years ago I believe that I changed my display name to "White Asian" as a joke. It hasn't been that for a long time now and I have no idea why it shows up like that when someone sends me a request on skype. I've tried changing every possible thing to do with a name in the profile/user settings to no avail. THe only time it shows up (that I'm aware of) is when someone adds me.
    So if you have any idea how I can fix this or why it's happening please let me know immediately!
    Its driving me mad because I don't know how to fix this!
    Thanks!
    Attachments:
    Untitled.png ‏11 KB

    Try this website. Yes its sprint but it might help you. http://support.sprint.com/support/article/Troubleshoot_issues_related_to_your_Sa msung_Galaxy_S_II_not_turning_on_completely/WTroubleshootingGuide_542_GKB51165-T rend?INTNAV=SU:DP:OV:TSIS:SamsungGalaxySIi-AsYouGo:TroubleshootIssuesRelatedToYo urSamsungG

  • How to implement this? please help

    In my java class, I have a string array called strarray which hold serveral elements, some of the elements have the same value , for example, the first element is "swimming", the forth element is also swimming. I use a for loop to get each element and give it to arrayHolder which is also a array with the same size as strarray. Now, what I want is: I defined a Vector called element I want this vector to filter out the element from arrayHolder, get the name of non-duplicated name from the arrayHolder, the result should be inside the element vector (swimming,walking,running,dancing), no duplicated name. My code is like follows:
    import java.util.*;
    import java.io.*;
    public class arrayTest{
    public static void main(String arg[]){
    String[] strarray={"swimming","running","walking","swimming","dancing","running"};
    String[] arrayHolder=new String[strarray.size];
    Vector element=new Vector();
    for(int i=0;i<strarray.length();i++){
    arrayHolder[  i  ]=strarray[  i  ];
    /* What should I do next to get the non-duplicated element from arrayHolder and
    * add them into the element vector????
    I did not finnish it, since I am a little bit confused, how to implement? Need some help. thanks.
    Message was edited by:
    Mellon

    Not sure if I see the use of strArray & arrayHolder (I've not looked at your code - you might use code tags next time (check the "code" button above the message textarea), but may I suggest using a Map of some sort instead of a Vector? It will prevent duplicates for you.
    Good Luck
    lee

  • Hello, i have a problem when i want to download an app it asks for my secret question and answer but i forgot it how can i solve this problem please help?

    Hello today I wanted to download an app on my ipod touch infact its a game and as usual it asked for my appl id and password so I entered them but next it asked me to enter my passowrd againg and answer the secret question I submited when I first got my Ipod touch, the problem is i cant remember the question neither the answer,so is there a way I can find out what my secret question is and the answer of course I would appreciate youre help.
    Fouad

    Only you and Apple know your secret question.  See if changing the password via email will allow access to your account.. Then you can chnag yur secret question. See:
    http://support.apple.com/kb/HE36

  • TS3367 I'm having trouble making Facetime calls with my iphone 4s.  I can receive them; however, I can not make them.  Any ideas of how to fix this? PLEASE HELP!!!  Thank you!

    I am having a problem making phone calls using Facetime.  I was able to use it on two separate occassions; however, now I can not.  I can receive calls, but can not make them.  Not sure what to do.  Any ideas?  Any help would be greatly appreciated.
    Thank you VERY much!

    There are a lot of posts in the forums today with people having problems with iMessage.   There was also a published outage yesterday, so it's possible there are still some issues that may be impacting you both.
    I would just wait it out - I'm sure it will be sorted out soon.

Maybe you are looking for

  • ITunes version 9.1 and Iphone 3GS version 4 syncing problem

    I updated my Iphone to the newest (4.0) software but when I plugged it in, it came up saying that the Iphone "Iphone" cannot be used because it requires iTunes version 9.2 or later but when I check for updates and the pop up comes up saying A new ver

  • Managing Multiple iPads for Education System

    What is the best solution to managing (charging, purchasing/installing apps, updates, etc) a set of 80-100 iPads?  This is for a school system where the schools are located throughout the state at approximately 27 different sites.

  • I book closes

    I book closes automatically after update

  • Windows8 64 bit , EVENT VIEWER ERROR LOG

    I just got a new windows 8- 64 bit notebook, I have only just set it up yet in event viewer I get lots of Error messages one is HP error ID 2146233088, some are marked caution and others are critical and all seem to be under HP, I installed all windo

  • Mountain lion notes won't sync with iPhone notes

    I must have a setting messed up but I just upgraded to 10.8.2 and iTunes 11.0 and I want to move the notes I have on my iPhone to my Mac.  I am having trouble syncing the two devices.  I didn't see anything in iTunes 11.0 to force a sync nor did I se