473,473 Members | 2,185 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to write log for every 10000 rows

12 New Member
Hi all,

This is my first time here. I have a doubt in writing c++ program to load a file of about 10million rows to the database. so when i read it, i need to track it if its loading properly for every 10000 times by writing a log. if anybody can help me out with this that will be great. thanks in advance.
Oct 11 '06 #1
4 2892
apiplani
8 New Member
take a temporary variable... after every read increament the variable.. if variable value = 10000 ( or whatever) print to the log file, re-initialize the variale to 0 :

double _temp_coutner = 0.0;

..
..
..

while (fread...)
{
_temp_counter++;
if ( _temp_counter == 10000)
{
fprintf(log_file,"Processed another 10000... now processing <%s>", data_structure_string);
_temp_counter=0;
}
.
.
.
.....

} //end of while
Oct 11 '06 #2
dusty
12 New Member
Thanks a lot for your help. It works.


take a temporary variable... after every read increament the variable.. if variable value = 10000 ( or whatever) print to the log file, re-initialize the variale to 0 :

double _temp_coutner = 0.0;

..
..
..

while (fread...)
{
_temp_counter++;
if ( _temp_counter == 10000)
{
fprintf(log_file,"Processed another 10000... now processing <%s>", data_structure_string);
_temp_counter=0;
}
.
.
.
.....

} //end of while
Oct 11 '06 #3
dusty
12 New Member
Sorry I have a question again. I understood the concept but do i have to add any header file b'cos when i compile the program it says log_file & data_structure_string are not declared. I dont get the concept of writing it to a log file. Thanks a lot in advance & for your reply.
Oct 12 '06 #4
D_C
293 Contributor
log_file and data_structure_string are variables. log_file is the file you are writing to as a log. You should be able to use a string to create a file handle, which you should call log_file, or whatever as long as it changes accordingly. data_structure_string is the data (a string most likely) that you are writing to the log file.

For example, if you wanted to write the first 10000 primes to a file called "C:\Docume~1\User\Desktop\primes.log", then log_file would be a pointer to the file handle, for C:\Docume~1\User\Desktop\primes.log. data_structure_string would be the first 10000 primes concatenated into one string.
Oct 12 '06 #5

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

Similar topics

2
by: Thomas | last post by:
What's the quickest way to write and read 10.000 integer values ( or more ) to and from a file? Using struct somehow? The example in the docs shows how to handle to or three arguments, but is the...
1
by: Ajay Garg | last post by:
I want to Insert 10000 rows at a time and commit in sql server , Is there a way to do it if the source tables have no id fields ? What would be the most efficient method? Thanks Ajay
3
by: sam | last post by:
Hello Group, Havent had luck posting it to microsoft.public.dotnet.framework.aspnet.datagridcontrol group. Excuse me for the cross posting. I have a datagrid which needs to be split into multiple...
2
by: Mats Mohlin | last post by:
We are runing a critical batchjob in DB2 V8 fp4 for AIX on a p630 with AIX 5.2 The job updates only 6 columns of the 100 columns in a 600 bytes wide row. The job is very IO bound because of log...
2
by: Luis Mendes | last post by:
How can I read and write images to SQL server to a field with the type "image". Can´t make DataBound work. Thank's in advance, Luis
20
by: Niyazi | last post by:
Hi all, I have a integer number from 1 to 37000. And I want to create a report in excel that shows in 4 alphanumeric length. Example: I can write the cutomerID from 1 to 9999 as: 1 ---->...
0
by: Aveblein | last post by:
Hello everyone! I am using MS Access 2003 to create an interface using forms to SQL Server, my problem is that when I try to insert from a table to another table more than 10000 rows, SQL Server only...
4
by: cbtechlists | last post by:
I have an ASP app that we've moved from a Windows 2000 to a Windows 2003 server (sql server 2000 to sql server 2005). The job runs fine on the old servers. Part of the app takes a recordset and...
25
by: mereba | last post by:
Hello My country Ghana is changing its currency. I want to write a small programme in C++ that can covert from the old currency into the new one. I would like this programme to run behind a simple...
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
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...
1
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

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.