473,804 Members | 3,373 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Uses of setvbuf()

Which situations call for the use of setvbuf(), specifically when you
supply the buffer yourself? What is the advantage of an user specified
buffer over an automatically allocated one? Can we call setvbuf() on
the predefined streams, immediatly upon start of main()? How often is
this function used in typical C programs?

Thanks.

Jan 5 '07
10 6949
Greetings,

santosh wrote:
Which situations call for the use of setvbuf(), specifically when you
supply the buffer yourself? What is the advantage of an user specified
buffer over an automatically allocated one? Can we call setvbuf() on
the predefined streams, immediatly upon start of main()? How often is
this function used in typical C programs?
As others have pointed out, change buffering mode is probably the most
common, but on one platform long ago the default buffer size was 512
bytes -- changing it to 32KB made a measurable difference in speed.

--
Kyle A. York
Sr. Subordinate Grunt
Jan 15 '07 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3070
by: Keith Doyle | last post by:
I'm curious if setvbuf behavior is known to be undefined with regards to effects it may have on the file pointer. I've found that the following code works different on AIX 4.3.3 xlc and FreeBSD gcc 2.95.2 19990314 than it does on SCO 5.0.4 cc or Linux gcc egcs-1.1.2 19991024. This is a bit curious as here's a gcc example that works one way and one that works the other, and I would think the relevant code is in libc/glibc. This is what...
6
4726
by: grunes | last post by:
I wish to fread a few thousand bytes at a time in turn from several very large files from a DVD data disk, under Redhat Fedora Linux. When this is done the DVD drive wastes a lot of time and almost shakes itself to pieces. I tried using setvbuf, with large buffers, e.g. (example only, not checked): #include <stdio.h>
2
2039
by: j0mbolar | last post by:
is using _IONBF with setvbf the general way of getting an unbuffered stream in a standardized way? or are system specific functions generally favored over c89's setvbuf?
5
2010
by: | last post by:
We have this situation: We have a unmanaged c++ executable located in a certain folder (a.exe) It loads a mixed mode managed/unmanaged dll using MFC dynamically from a completely different path (b.dll) This last dll, uses other pure managed and mixed managed/unmanaged dll's that uses MFC. (c.dll, d.dll,...) What works is a.exe loading b.dll. But once I want to use a functions in c.dll I get an exception indicating that c.dll is not...
2
12376
by: ChasW | last post by:
Greetings, I have a form that uses a query as its record source. In the form I have a text box that uses this as its control source: =DCount("", "qry_Search_by_Name") The DCount function works properly with the query until I add a criteria to the query like this:
4
2974
by: Rob Dob | last post by:
Hi, I have both a Customer and a Orders Table, the key field is CustomerID. I also have a DataGrid that uses a BindingSource which uses a dataset which uses a join between the Customers table and the Orders table. Everything displays correctly and when I double click on a row within the datagrid I then open up a tabbed form that contains a detailed view of the record selected. The user at this point is able to make changes to the...
2
1297
by: Serg | last post by:
Hi, all I have a trouble. I have a WebService that uses MCpp assembly that uses some MFC classes. Everything perfectly works on my machine. But when i install web site on clients machine it does not work. Trying to open an aspx page i get error "could not load assembly or one of its dependencies". I think this is because of using MFC. What should i do to make it work?
2
4628
by: sitko | last post by:
Hi, I'm creating a quick utility which will copy one file into another, but I need it to have the ability to select out certain lines not to copy. I figured I'd use fread/fwrite but set the buffering size to a line with "setvbuf", here is the code I was going to use as a skeleton for this: #include <stddef.h> #include <stdio.h> #define FAIL 0 #define SUCCESS 1
2
4273
by: vippstar | last post by:
Is there a memory leak in this particular program: #include <stdio.h> #include <stdlib.h> int main(void) { printf("Hello, world\n"); if(setvbuf(stdout, NULL, _IONBF, 0) != 0) { perror("setvbuf");
0
9576
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10567
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10310
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7613
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6847
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5515
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5647
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3809
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2983
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.