Solved

C++ Language question

Posted on 1997-08-31
4
1,270 Views
Last Modified: 2008-03-10
    The application must run for a long period of operation. But, there are times wherein the "Unable to Create File Buffer" error occurs.
The said error is a bug confirmed by Microsoft (An ODBC error). Resolutions to avoid the error are stated in the Microsoft Knowledge Base; However, same error is encountered after I have done the following suggested solutions:
   a. create a file named CTT0.TMP and CTT.TMP
   b. Though the application doesn't need these much setting, still, I increase the number specified by the "FILES=" (FILES = 80) in Config.sys; and  set the handle Count to 40.
   c. HD available space = 500MB.

   Are there any other resolutions that I don't know?
0
Comment
Question by:uis
  • 2
4 Comments
 

Author Comment

by:uis
ID: 1168499
Edited text of question
0
 
LVL 3

Expert Comment

by:msmits
ID: 1168500
What is the exact problem according to the Microsoft KB? Is it a memory leak problem or a file handle problem?
Can you give the reference to the KB artice?

0
 

Author Comment

by:uis
ID: 1168501
reference:
       Microsoft Knowledge Base --
         Article ID:Q115516 PRB: S1000: "Unable to create file                               buffer" ODBC Error
                                             
                    Q130719 FIX: "Unable to create file buffer"                             32-Bit ODBC Error


Below are the information found in Microsoft knowledge Base:
1. PRB: S1000: "Unable to create file buffer" ODBC Error
  Last reviewed: July
  31, 1997
  Article ID:
  Q115516
  The information in this article applies to:
       The Microsoft Foundation Classes (MFC) included with: - Microsoft Visual C++ for Windows, versions 1.5, 1.51, 1.52 - Microsoft Visual C++, 32-bit Edition, versions 2.0, 2.1, 4.0, 4.1, 4.2, 4.2b, 5.0
 
SYMPTOMS
  The following error may occur when calling Open() for a   CDatabase or CRecordset object:
     General error: Unable to create file buffer.
     State:S1000,Native:0,Origin:[Microsoft][ODBC Cursor Library]
     -or-
     General error: Unable to write to file buffer
     State:S1000, Native:0, Origin:[Microsoft][ODBC Cursor      Library]
     -or-
     General error: Unable to close file buffer
     State:S1000, Native:0, Origin:[Microsoft][ODBC Cursor      Library]
CAUSE
     By default the MFC ODBC CDatabase class loads the ODBC   cursor library (16 bit:
  ODBCCURS.DLL, 32 bit: ODBCCR32.dll). This allows an application   to define snapshot recordsets (the default) and scroll backward   as well as forward through the recordset. This cursor library    caches the records of a snapshot. To perform the caching, the    16-bit cursor library creates a temporary file in the directory   specified by the TEMP environment variable or, ifthe TEMP     variable is not defined, in the current directory. The 32-bit    cursor library creates a temporary file in the current     directory. A temporary file is created for each CRecordset     object created. If the temporary file cannot be created, the   error shown above occurs. This error most likely occurs for one   of the following reasons:
       There are not enough file handles available for the       application.
       -or-
       There is not enough hard disk space available to create   the file.

RESOLUTION
  To avoid the error, increase the number of available file handles for the application. This can be done
  by calling the Windows API function SetHandleCount(). Also, increase the number specified by the
  "FILES=" line in the CONFIG.SYS file.

  NOTE: On Windows NT calling SetHandleCount() has no effect and Windows NT ignores the config.sys file. Windows NT limits file handles solely on the amount of available memory.

  Make sure that there is plenty of disk space available in the directory specified by the TEMP environment variable or the current working directory.

2.FIX: "Unable to Create File Buffer" 32-Bit ODBC Error
  Last reviewed: July
  2, 1997
  Article ID:
  Q130719
  1.50 1.51 1.52 1.52a | 2.00 2.10 2.20
  WINDOWS              | WINDOWS NT

  kbinterop kbbuglist kbfixlist

  The information in this article applies to:
  The Microsoft Foundation Classes (MFC) included with:
  - Microsoft Visual C++ for Windows, versions 1.50, 1.51, 1.52
  - Microsoft Visual C++, 32-bit Edition, versions 2.0, 2.1, 2.2

  SYMPTOMS
  After a long period of successful operation, an application generates the following ODBC error when that application uses the MFC database classes such that the 32-bit ODBC cursor library:
     General error: Unable to create file buffer
     State:S1000,Native:0,Origin:[Microsoft][ODBC Cursor Library]
CAUSE
  The ODBC cursor library generates temporary files for its own use. To ensure that the temporary file names are unique, the 32-bit ODBC cursor library generates temporary file names that include a hex number. That number is incremented every time a new filename is generated. Here is an example of filenames that are genrated by the cursor library for its temporary files:
     CTT1111.TMP
     CTT1112.TMP
     CTT1113.TMP
  When the hex number embedded in the filename wraps from FFFF to 0, the error is generated:
     CTTFFFD.TMP
     CTTFFFE.TMP
     CTTFFFF.TMP
     CTT0.TMP     <-- This temporary filename causes the error
RESOLUTION

  To avoid the error, create a file named CTT0.TMP, and place it in the directory that the cursor library uses to generate its temporary files. Temporary files are created in the current working directory with the 32-bit cursor library. The cursor library will see the existing file with that name and skip over it to the next filename (CTT1.TMP).

STATUS

  Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This problem has been corrected in the ODBC cursor library that ships with Visual C++ 4.0 and 4.1 (ODBCCR32.DLL, version 2.50.3006).

MORE INFORMATION
  This problem applies only to the 32-bit ODBC components. However, the 16-bit MFC programs can thunk to the 32-bit components when running on Windows NT if you've set up a 32-bit data source rather than a 16-bit data source.

  The error described in this article can appear for other reasons. Please see the following article in the Microsoft Knowledge Base:

     ARTICLE-ID: Q115516
     TITLE     : PRB: S1000: "Unable to create file buffer" ODBC Error

  In general, other reasons produce a failure immediately upon trying to use the ODBC components. The problem described in this article produces a failure after a long period of successful operation.  For example, doing a large number of requeries can cause the error.
0
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 100 total points
ID: 1168502
The problem may be coming from not enough file handles. Usually, if an application needs to run for a long time, the best thing to do is to keep the state of the application as static as possible. Meaning, the program should not be constantly needing more memory or for that matter, any more resources. Have you made sure that your application is closing all of its unneeded tables and not opening the same ones more than once?


0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now