what is the correct positon of filepointer, in this project?

1
2
3
4
5
6
7
8
9
10
11
12
13
wstring receives_data ;
  
  receives_data.resize(20);  
  DWORD Byte_already_read ;

  SetFilePointer(check_file, 172, NULL, FILE_BEGIN); 

  ReadFile(check_file, &receives_data, 20, &Byte_already_read,NULL);
unsigned int num = 0; 

  wstringstream convert(receives_data) ; //i need to change wstring to number
   
  if (!(convert >> num))   ...


my.txt content is below


i want receives_data to be "1 2 4 6 4 2 9 4 0 9" , the number in .txt
what is the correct position number ? 172 seems to be wrong

this program only run on 32/64 bit windows?

i am very worry now(:

i use below code:


i can't get the data from txt, wrong receive_data
i want the unsigned int--> num to be 1246429409

my project is unicode project~ ~

can anyone help me to post the correct code?
thanks
Last edited on
+ receives_data "탐Ȃ탑Ȃ탒Ȃ탓Ȃ탔Ȃ탕Ȃ탖Ȃ탗Ȃ탘Ȃ탙Ȃ탚Ȃ탛Ȃ태Ȃ택Ȃ탞Ȃ탟Ȃ탠Ȃ탡Ȃ탢Ȃ탣Ȃ탤Ȃ탥Ȃ탦Ȃ탧Ȃ탨Ȃ탩Ȃ탪Ȃ탫Ȃ탬Ȃ탭Ȃ탮Ȃ탯Ȃ탰Ȃ탱Ȃ탲Ȃ탳Ȃ탴Ȃ탵Ȃ탶Ȃ탷Ȃ탸Ȃ탹Ȃ탺Ȃ탻Ȃ탼Ȃ탽Ȃ탾Ȃ탿Ȃ턂Ȃ턃Ȃ턄Ȃ턅Ȃ턆Ȃ턇Ȃ턈Ȃ턉Ȃ턊Ȃ턋Ȃ턌Ȃ턍Ȃ턎Ȃ턏Ȃ턐Ȃ턑Ȃ턒Ȃ턓Ȃ턔Ȃ턕Ȃ턖Ȃ턗Ȃ턘Ȃ턙Ȃ턚Ȃ턛Ȃ턜Ȃ턝Ȃ턞Ȃ턟Ȃ턠Ȃ std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t> >


this is my VC debug result of receives_data value
Last edited on
can anyone help?
i find out the problem come form
ReadFile(check_file, &receives_data[0], 20, &Byte_already_read,NULL);

i miss [0] before~ ~

never never never never NEVER read directly to a string or wstring or any other complex object type!
Topic archived. No new replies allowed.