473,400 Members | 2,163 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,400 software developers and data experts.

generating autoincrement value

hi
iam interested in generating a variable value by autoincrementing, in CGI using c

as user enters some data, i want to generate an index for it,
and store in a binary file with data,
as we create a field in mysql with autoincrement.
Jun 6 '07 #1
4 2783
Silent1Mezzo
208 100+
hi
iam interested in generating a variable value by autoincrementing, in CGI using c

as user enters some data, i want to generate an index for it,
and store in a binary file with data,
as we create a field in mysql with autoincrement.
I'm kind of confused as to what your question is. Are you wanting to count the number of times a user enters data? In that case you'd just do this

Expand|Select|Wrap|Line Numbers
  1. int cnt = 0;
  2. //User enters data
  3. cnt++;
Jun 6 '07 #2
I'm kind of confused as to what your question is. Are you wanting to count the number of times a user enters data? In that case you'd just do this

Expand|Select|Wrap|Line Numbers
  1. int cnt = 0;
  2. //User enters data
  3. cnt++;
from front end(HTML PAGE) if user enters data, i want to store with data the index, in to a binary file
so this index should increment next time another request comes in CGI c program.
as we do in anydata base
Jun 6 '07 #3
weaknessforcats
9,208 Expert Mod 8TB
The recommended approach is to use a Singleton to manage the count. (See the Singleton article in the C/C++ Articles forum).

You could also use a local static variable for the count but a) this approach is deprecated in C++, and b) is not thread-safe so you can't do this on multiple threads.
Jun 6 '07 #4
The recommended approach is to use a Singleton to manage the count. (See the Singleton article in the C/C++ Articles forum).

You could also use a local static variable for the count but a) this approach is deprecated in C++, and b) is not thread-safe so you can't do this on multiple threads.
i would like to generate in c
Jun 8 '07 #5

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

Similar topics

4
by: jaYPee | last post by:
I have a table in my sqlserver 2000 that has a field IDNO. i want this field to be my primary key. however i don't want this field to use the autoincrement feature. when i access this table from...
0
by: Marko Maehner | last post by:
Hi, I have a strange problem with my xml file. In the schema of this xml file I have set one column to autoincrement. When I enter the data in my xml file directly, the autoincrement-column gets...
2
by: RA | last post by:
Hi I have the following datarow that I want to add to a datatable. DataRow newRow = ds.Tables.NewRow (); newRow = Cache.ToString (); newRow = Cache.ToString (); ds.Tables.Rows.Add...
6
by: Dennis | last post by:
I have set a DataTable and one of the columns I set "AutoIncrement" to True. I then populate the Table by setting the columns to values then add the row to the table. I inadverently set the...
1
by: Sam | last post by:
Hi all I have a simple datagrid form which has 4 columns. The first one is used just like a key and the other threes allow user to enter numbers. The problem that I am having is that when I...
6
by: Michael | last post by:
I am trying to create an access database within Net 2003 using the ADOX library which works fine except when I try to add the AutoIncrement property to the ContactId column. I am experiencing a...
5
by: JC Voon | last post by:
Hi: How to reset the autoincrement value generated by DataTable ? I've master and detail table, the detail table has a autoincrement column, each time i add a new master record, i need to...
1
by: Mike | last post by:
I have a form that has an embedded subform (Datasheet View) that are linked based on a 1-many ID field. I have a field (SET) in my embedded subform that I want to Autoincrement starting with...
4
by: Tim | last post by:
Hello All, I could use some help on an error that is just now popping it's head up. Seems that the autoincrement numeric has hit 32,767. The autoincrement is used in various locations in the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.