code_junkie

Using char array properly in vc++

Nov 14th, 2011
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. char data1[] = "";
  2. int offset = 0;
  3.  
  4. LPTSTR pszString = NULL;
  5. LPSTREAM lpStream = NULL;
  6.  
  7. CreateStreamOnHGlobal(NULL, TRUE, &lpStream);
  8. StreamStringCopy ((LPSTREAM)lpStream, (LPCTSTR)"");
  9. while(of->pread(&data1,1023,offset) > 0){
  10. LPCTSTR tempStr = data1;
  11. StreamStringCat ((LPSTREAM)lpStream, tempStr);
  12. offset = offset + strlen(data1);
  13. }
  14. Bitmap bm(lpStream,FALSE);
  15. bm.GetHBITMAP(Color.Black, &ret);
  16.  
  17. char* data1 = static_cast<char*> (std::malloc (1024 * sizeof (char));
  18.  
  19. ...
  20.  
  21. std::free (data1);
  22.  
  23. // or try this
  24. char data1 [1024] = { 0 }; // Gives you 1024 bytes to write to on the stack
Add Comment
Please, Sign In to add comment