Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
S

scrname

@scrname
About
Posts
5
Topics
4
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Overwriting struct in binary file
    S scrname

    I have a question. I wrote and array of 5 structs into a binary file. I need to be able to go to a specific position in a binary file and overwrite that struct with another. I have tried it but when i go to overwrite the struct the ones before it all the data is screwed up.Can anyone help me on how to overwrite a specific person in the file. struct PERSON { int age; int weight; char name[25]; }; void write_names() //WRITES 5 PEOPLE TO THE FILE { ofstream out; PERSON p[5]; int ct; p[0].age = 1; p[0].weight = 1; strcpy(p[0].name, "Num_1"); p[1].age = 2; p[1].weight = 2; strcpy(p[1].name, "Num_2"); p[2].age = 3; p[2].weight = 3; strcpy(p[2].name, "Num_3"); p[3].age = 4; p[3].weight = 4; strcpy(p[3].name, "Num_4"); p[4].age = 5; p[4].weight = 5; strcpy(p[4].name, "Num_5"); out.open("file.dta", ios::binary); for (ct=0; ct<5; ct++) out.write((char*)& p[ct], sizeof(p[ct])); out.close(); } void show_names() //SHOW ALL THE PEOPLE IN THE FILE { ifstream f; f.open("file.dta", ios::binary); PERSON p[10]; int ct; int num = 0; while(!f.eof()) { f.read((char*)& p[num], sizeof(p[num])); num++; } num--; for(ct=0; ct

    Managed C++/CLI ios data-structures help tutorial question

  • difference
    S scrname

    this is a noob question but i am a noob so i guess it fits me. i want to know what is the difference between all of the catagoreis like it sayes visual c++, managed c++, visual basic, c#, win32 exct... and what is it used for .

    IT & Infrastructure c++ question csharp

  • File I/O Problem
    S scrname

    ya i tryed putting it in a stuct but it would do the same thing so i just tryed it with it out

    C / C++ / MFC question help tutorial c++ data-structures

  • File I/O Problem
    S scrname

    >>L_Name[x] >>number[x]; x++; } read.close(); //Where the user can enter more name do { cout <<"First Name: "; cin >>F_Name[x]; cout <<"Last Name: "; cin >>L_Name[x]; cout <<"Number: "; cin >>number[x]; x++; cout <<"Would you like to enter another name?(y/n)"; cin >>resp; } while((resp=='y')||(resp=='Y')); y=x; //writes the origianl names then the new name but here is where i get the //set of numbers ofstream write("File.txt"); for(x=0; x

    C / C++ / MFC question help tutorial c++ data-structures

  • File I/O Problem
    S scrname

    >>L_Name[x] >>number[x]; x++; } read.close(); //Where the user can enter more name do { cout <<"First Name: "; cin >>F_Name[x]; cout <<"Last Name: "; cin >>L_Name[x]; cout <<"Number: "; cin >>number[x]; x++; cout <<"Would you like to enter another name?(y/n)"; cin >>resp; } while((resp=='y')||(resp=='Y')); y=x; //writes the origianl names then the new name but here is where i get the //set of numbers ofstream write("File.txt"); for(x=0; x

    C# question help tutorial c++ data-structures
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups