473,594 Members | 2,713 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

debug assertion failed str!=NULL fprintf.c

Hi,

I have an application with a function "myfunction " that opens a file
and writes to it using fprintf.
This application runs on a unix (sun solaris 5.8) system.
I connect to this application from a VB GUi on a windows 2000 system.
The GUI invokes "myfunction ".

I get the following error:-

"debug assertion failed str!=NULL fprintf.c"

The check for NULL handler is in place.The code is similar to teh
following lines:-

FILE *fp;
fp=fopen("myfil e.txt","a");
if (fp==NULL)
exit(1);

fprintf(fp,"hel lo");

Since I check for the FILE handler for NULL value before executing
fprintf,why should I get the debug assertion failed error.

Thanks
Arti
Jul 22 '05 #1
2 17597
Arti Potnis wrote:
I have an application with a function "myfunction " that opens a file
and writes to it using fprintf.
This application runs on a unix (sun solaris 5.8) system.
I connect to this application from a VB GUi on a windows 2000 system.
The GUI invokes "myfunction ".

I get the following error:-

"debug assertion failed str!=NULL fprintf.c"

The check for NULL handler is in place.The code is similar to teh
following lines:-

FILE *fp;
fp=fopen("myfil e.txt","a");
if (fp==NULL)
exit(1);

fprintf(fp,"hel lo");
So, you're just printing "hello" into that file? Or is it a bit more
complicated? Try doing exactly what you wrote here. Output "hello"
and see if there is a difference.

Since I check for the FILE handler for NULL value before executing
fprintf,why should I get the debug assertion failed error.


If I read the assertion correctly, it's not the file pointer that is
NULL, it's most likely the format string. Now, when you say "the code
is similar", we cannot help you. You need to post the _actual_ code.
But don't post all of it. Reduce it to the minimal program that does
exhibit the said behaviour.

Also, have you tried simply debugging your application without the VB
GUI thing calling it? What you need to do is isolate your problem. Is
it in the connectivity code? Is it in the UNIX program? Replace the
connectivity part with a simple piece of code that drives the rest of
the UNIX side and see if it makes any difference.

Good luck!

Victor
Jul 22 '05 #2

"Arti Potnis" <ar******@yahoo .com> wrote in message
news:ec******** *************** ***@posting.goo gle.com...
Hi,

I have an application with a function "myfunction " that opens a file
and writes to it using fprintf.
This application runs on a unix (sun solaris 5.8) system.
I connect to this application from a VB GUi on a windows 2000 system.
The GUI invokes "myfunction ".

I get the following error:-

"debug assertion failed str!=NULL fprintf.c"

The check for NULL handler is in place.The code is similar to teh
following lines:-

FILE *fp;
fp=fopen("myfil e.txt","a");
if (fp==NULL)
exit(1);

fprintf(fp,"hel lo");

Since I check for the FILE handler for NULL value before executing
fprintf,why should I get the debug assertion failed error.


The problem is the string is NULL, not the file pointer. You say you're
invoking a function in another application? If you're passing the string
from one application to another, you need to read up how to do that safely
on your operating system. Passing a pointer (such as a char*) will usually
not work, because the memory from one app is often not accessible to another
app.

-Howard


Jul 22 '05 #3

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

Similar topics

0
2016
by: Chemix | last post by:
Hello people, I've developed a windows forms application with VC++.NET. The problem I have is the next: I run my application and all seems go OK, but passed a certain time (it can be hours or some minutes), then a dialog window opens with the title:Microsoft Visual C++ Debug Library, and the next error: Debug Assertion Failed! Program: name of my program File: dbgheap.c Line: 1132 Expression: _CrtIsValidHeadPointer(pUserData)
6
595
by: Cormac | last post by:
Hi everyone, I'm writing Pure Data externals in C++ using Ms Visual C++ 7.0 and Windows2000. I'm running motions sensor hardware so there's a bit of real time data processing involved. When I'm running my objects in Pure Data, I get an assertion failure after a few seconds of running the motion sensors and I can't seem to get rid of it. The error occurs in the expression _CrtCheckMemory(). Could anyone provide some possible solutions?
1
2751
by: Kapt. Boogschutter | last post by:
Does anyone know Why I'm getting this Error??? Debug Assertion Failed! File: daocore.cpp Line: 42 My code: CDaoDatabase dao; dao.Create("filename");
4
4294
by: A_StClaire_ | last post by:
I read a section of my text on smart "counting" pointers and found it confusing so I decided to get hands-on. however I'm getting "Debug Assertion Failed... Expression: _BLOCK_TYPE_IS_VALID(pHead->nBlockUse)" whenever I run my code below. program works fine after I bypass the msg. any ideas? thx a lot.
2
8359
by: marat | last post by:
I have a managed c++ function below that makes a call to an unmanaged c++ dll .. This function is called from a C# app, resulting in a "Debug Assertion Failed dbgdel.cpp Line 52 Expression: _BLOCK_TYPE_IS_VALID(pHead->nBlockUse)" errir message. This happens on function exit, looks like related to destruction of some vector. Any ideas why ????
4
13558
by: ellieong | last post by:
When i try to run my program, i get this error "debug assertion failed!" and it's caused by this file called "afxtempl.h" at line 262. isn't this header file provided by c++? so how can i get rid of this problem. if i click ignore i can see the output, but how can i get rid of such an error msg?
0
2931
by: lawrence | last post by:
Hi, I made a MFC ActiveX with a CwinThread Class in VC ++. Then i used it on Visual basic. When i try to make an exe i got this error : Debug Assertion Failed! Program: C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\VB98\VB6.EXE File: cmdtarg.cpp Line: 52
2
13028
by: karspy | last post by:
In my COM Server i have added Dialog Box. i have registered OCX file and added that Activex Control to my Project also. It has created 1 header file and 1 source file. After that i have created an instance(object) of that ActiveX control and trying to call functions, But its giving run time error. Debug Assertion Filed! File: winocc.cpp Line: 345
2
2443
by: Gone With Wind | last post by:
I am a novice of C++. I write the following code to append strings to a Combox (m_RibNum). This control component is on a PropertyPage hosted on a PropertySheet. int i; char buffer; CString s for (i=0;i<5;i++) { itoa(i+1,buffer,10);
1
5795
by: jerry | last post by:
i have a problem: when i run a program,it pop up a windows,title is microsoft visual c++ failed! contents are: program: ...io\myprojects\phonebook\debug\phonebook.exe file:fopen.c line:54 expression: *file !=_T('\0') for information on how your program can cause an assertion failure,see the visual c++ doucmention on asserts.
0
7876
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
8251
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...
0
8372
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8003
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,...
0
8234
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6654
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5408
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
3859
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
1210
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.