473,405 Members | 2,210 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

function works properly for small datasets but i have problem with

15
Expand|Select|Wrap|Line Numbers
  1. void CSVImageIO::Read( void * buffer)
  2.     char onedataline[8000000];
  3.     char *tmp=0;
  4.     double d=0;
  5.     unsigned short data=0;
  6.     unsigned short * inptr = static_cast< unsigned short * >( buffer );
  7.     unsigned short * tmp_buf=0;
  8.  
  9.     //copy the pointer to the buffer, because we are going to change the pointer soon
  10.     tmp_buf=inptr;
  11.  
  12.     //print the data for check
  13.     std::ofstream     m_OutputStream("D:\\MIP\\outdata.csv");
  14.  
  15.     //open file
  16.     this->m_InputStream.open(this->m_FileName.c_str(), std::ios::in);
  17.  
  18.     //seek to data position
  19.     m_InputStream.seekg(data_position);
  20.  
  21.  
  22.  
  23.     int i=0,j=0,k=0;
  24.  
  25.  
  26.     do 
  27.     {    
  28.         memset(onedataline,0,8000000);
  29.         m_InputStream.getline(onedataline, 8000000, '\n');
  30.         tmp=(char*)onedataline;
  31.         while(get_next_double(&tmp,&d)==0)
  32.         {
  33.             data=(unsigned short)((double)fabs(d)*10000);
  34.             *(tmp_buf++)=data; //here is the error message
  35.             i++;
  36.             m_OutputStream << data << " ";
  37.         }
  38.  
  39.             m_OutputStream <<endl;
  40.  
  41.         //m_InputStream.getline(onedataline, 65000, '\n');
  42.     }while(!m_InputStream.eof());
  43.  
  44.     std::cout << "data read: " << i << std::endl;
  45.  
  46.  
  47.  
  48.  
  49.   this->m_InputStream.close(); 
  50.  
This function works properly for small datasets but i have problem with
large datasets and i get the follow error message.
I get this error message:Unhandled exception at 0x004d4286 in US.exe: 0xC0000005: Access violation writing location 0x0ad28000.

Please, if anybody knows, help me..
Thnx guys!!
Jan 9 '08 #1
1 1366
Savage
1,764 Expert 1GB
This function works properly for small datasets but i have problem with
large datasets and i get the follow error message.
I get this error message:Unhandled exception at 0x004d4286 in US.exe: 0xC0000005: Access violation writing location 0x0ad28000.
How do you allocate the buffer,which is passed as function argument?
Also allocatin 8e6 bytes,is not a good idea,allocate it dynamically instead.

PS:Please use code tags around your code.
Jan 9 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Bob Murdoch | last post by:
I have an ASP application that calls a COM function to create a custom report as an Excel file. This works in a synchronous fashion, as long as the report does not take too long to create. If...
4
by: Stephen Poley | last post by:
Apologies if this is a silly question, but Googling on the archive didn't produce any answers. I have a piece of inline Javascript which works as expected in IE 6, Opera 7, Mozilla and NN 4. In...
5
by: amit kumar | last post by:
I am calling a function which returns pointer to a map. The declaration of the map is map<int,vectxyz*>. vectxyz is a vector containing pointer to a class xyz. For map<int,vectxyz*>* p1 In the...
17
by: kalamos | last post by:
This statement fails update ded_temp a set a.balance = (select sum(b.ln_amt) from ded_temp b where a.cust_no = b.cust_no and a.ded_type_cd = b.ded_type_cd and a.chk_no = b.chk_no group by...
6
by: D | last post by:
I am trying to do this in C# Function Num2Let(L As Long) As String Dim s0 As String, s1 As String, S2 As String, s3 As String If L > 18278 Then s0 = Chr((Int((L - 18279) / 17576) Mod 26) + 65)...
89
by: Cuthbert | last post by:
After compiling the source code with gcc v.4.1.1, I got a warning message: "/tmp/ccixzSIL.o: In function 'main';ex.c: (.text+0x9a): warning: the 'gets' function is dangerous and should not be...
57
by: Robert Seacord | last post by:
i am trying to print the address of a function without getting a compiler warning (i am compiling with gcc with alot of flags). if i try this: printf("%p", f); i get: warning: format %p...
23
by: dangerd | last post by:
hi there, I used css for a page, it worked but only in IE not in firefox. What DOCTYPE whould I use for firefox. the external stylesheet contains the following: body { background-color:...
2
by: Oltmans | last post by:
Hi all, I'm stuck in a situation where I need help. Any help will be highly appreciated. I've created an object, after creating the object, I'm assigning one of its functions to an event handler...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.