this is my code, when I comment all output code(printf cout), the compiler told me "Debug Error!", why?

#include <stdio.h>
#include <string.h>
#include <iostream>
using namespace std;

int main ()
{
	char buf[]="     1     1  1201     1  -0.349200000000000D+06   0.115200000000000D+06";

	char* cpr;
/*	cout<<sizeof(buf)<<endl;*/

/*	cout<<(buf+25)<<endl;*/
	for (cpr = buf+25; cpr <buf+710; )
	{
		if( (cpr=strchr( cpr, 'D') )!=NULL)
		{	
			*cpr = 'E';
		}
		else{
			cpr = buf+710;
		}
	}
	
/*	printf("%s\n",buf);*/ comment 
	double t;
	double r;
	sscanf(buf+25, "%24le%24le", &t, &r);
/*	printf("%f\n%f\n", t, r);*/
	return 0;
}

You have the word comment in your code outside of any of the comments

/* printf("%s\n",buf);*/ comment

sorry, the "comment" [line 25] outside the comment area is just to notice this sentence. if this is not exist, the code still can't work.

I think sscanf must couple with a output. such as printf, cout etc.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.