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

windows C++ compiler option to link user define printf

6
Hi,
I have rewritten a printf function according to my usage and I want call my printf function instead the standard printf function during my project execution.
Can anybody tell me what is the windows C++ compiler option in Visual studio 2005, so that I can tell the windows compiler to use my printf function.
Mar 18 '08 #1
2 2848
Banfa
9,065 Expert Mod 8TB
You don't need one. If a function exists in both your code and the library the linker should default to using the code you provide.
Mar 18 '08 #2
Mant
6
I have a project written in C if I build it using Borland C++ compiler things are going on fine and if I build using Visual Studio compiler its not.

The scenario is,
I have a project which is in C, in one of the file I have redefined the printf function. Below

// This printf will write on to a file instead on stdout

// myfile.c
#define printf(format, ...) \
perprintf(format, __VA_ARGS__)

int perprintf (const char *format, ...)
{

va_list args;
FILE* fptr;
va_start (args, format);
fptr = fopen("C://TestPrintf.txt", "at");

vfprintf(fptr, format, args);
fflush(fptr);

va_end(args);
fclose(fptr);
return 1;
}


//outsidefile.c
printf(msg);

If I call printf in the same file then its calling my printf function, printf's written outside this file are unable to call this printf function. And I expect my printf function to be called outside that file as well.

So I was wondering how to tell the outside files that the printf function is overrriden? and to use this printf at any point of time.
Mar 18 '08 #3

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

Similar topics

4
by: Christopher M. Lusardi | last post by:
Hello, Can I run the subject line program using CC instead of cc? I attempted to use the "-c" option and it told me things were undefined. Isn't this CC option the same as the cc -c option? ...
6
by: vsnadagouda | last post by:
Hello All, For one of my applications I need to know what are all the predefined system/ compiler specific macros are. All these days I used to use "-v" or "-#" as a compiler option to figure...
3
by: Chris Paul | last post by:
I'm having trouble with PHP & PostgreSQL/OpenLDAP/Apache on Windows. I've set this up countless times on BSD (piece of cake) but I'm trying to do this on Windows now so that my developer can work...
2
by: spidey12345 | last post by:
what i need this program to do is to read paragraphs like "st blah blh test ere se sit blha eere w" and then it will reformat to "st blah...
10
by: Matt | last post by:
Hey guys. I'm currently learnign C and I've been reading on the GNU website how I should be using the getline() function instead of "unsafe" functions such as gets(); so to build good habits I wish...
16
by: John | last post by:
I am looking for VBA code that will work with Access 2003 to enable dragging and dropping a file/folder name from Windows XP Explorer into an Access form's text box. This is a common functionality...
27
by: Dave | last post by:
I'm having a hard time tying to build gcc 4.3.1 on Solaris using the GNU compilers. I then decided to try to use Sun's compiler. The Sun Studio 12 compiler reports the following code, which is in...
0
AmberJain
by: AmberJain | last post by:
Windows Autorun FAQs: Overview NOTE- This complete article on "Windows Autorun FAQs" applies theoretically to all Windows NT-based OSes till Windows Vista (and probably Vista's successors too)....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.