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

runtime error seems to be caused by scanf in VSP 6.0

I have a C consloe application in windows using Visual Studio Pro 6.0 that gives a runtime error: Debug Error! During the scanf line.

If I put a printf loop in after the scanf loop to print the values to the screen it runs and it is clear everything is reading ok. I remove the printf and it won't run at all. I pared down the program until I got to the bare minimum code I could while keeping the error. Any insight as to what the cause is would be greatly appreciated.

rob

\/ Multiequater2000.cpp : Defines the entry point for the console application.

#include "stdafx.h"
#include <stdio.h>
#include <stdlib.h>



void CreateFCIPFiles();


int main(int argc, char* argv[])
{
CreateFCIPFiles();

return 0;
}

void CreateFCIPFiles()
{

struct itemInfo
{
int id, model, linking;
double a, b, c, thresh1, thresh2, thresh3, thresh4;
};

char line[80];
struct itemInfo items[78];
int conditionCounter, yearCounter, repCounter, itemCounter;
FILE *fpItemInfo;


conditionCounter = 0;
yearCounter = 1;
repCounter = 1;


sprintf(line, "equating_project\\condition%2.2i\\year%2.2i\\pram ref%2.2i.txt", conditionCounter, yearCounter, repCounter);

if (( fpItemInfo = fopen( line, "r")) == NULL)
{
printf("Input specification file %s cannot be opened.\n\n", line);
exit (1);
}

for(itemCounter = 0; itemCounter<78; itemCounter++)
{
fscanf(fpItemInfo, "%i %i %i %lf %lf %lf %lf %lf %lf %lf", &items[itemCounter].id, &items[itemCounter].model, &items[itemCounter].linking, &items[itemCounter].a, &items[itemCounter].b, &items[itemCounter].c, &items[itemCounter].thresh1, &items[itemCounter].thresh2, &items[itemCounter].thresh3, &items[itemCounter].thresh4);
}

fclose(fpItemInfo);
}


this is a sample of the first line form the input file being read:

226316 1 0 1.02681 -0.93143 0.13604 0.00000 0.00000 0.00000 0.00000
Jul 3 '06 #1
1 2014
Just for the record, it seems that this is a compiler bug. THis code runs fine in at least 3 other compilers across 2 different OSes with no problems.

rob
Jul 4 '06 #2

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

Similar topics

7
by: cppaddict | last post by:
Hi, I've been trying to debug a strange runtime error for the last 5 hours... I'm hoping someone might have an insight about it. I have an application that creates a vector of MyDisplay...
6
by: Peter Frost | last post by:
Please help I don't know if this is possible but what I would really like to do is to use On Error Goto to capture the code that is being executed when an error occurs. Any help would be much...
3
by: Antti Keskinen | last post by:
Hello ppl ! Since this newsgroup is a place where Microsoft MVPs or related visit somewhat often, could someone give me an advice with possible causes of this error. Note that it does not happen...
2
by: Massimo Soricetti | last post by:
Hello, I'm trying to fix this little class: <code> #include <ifstream> #include <iostream> #include <iomanip> using namespace std;
7
by: steve | last post by:
Hi All I urgently need help on setting datagridview cell borders at runtime I found some code on the web from Programming Smart Client Data Applications with .NET 2.0 by Brian Noyes See...
4
by: John Doe | last post by:
segmentation error !!!! hi guys , i wrote this program to multiply two matrices (just the basic code without checkin 4 the condition n==p ) " #include<stdio.h> main() { int a,b,c; int...
17
by: Neil | last post by:
A client of mine likes some of the new bells and whistles in Access 2007, and is thinking about converting our A03 format MDB to an A07 format file. However, while some of the users have A07, many...
9
xpun
by: xpun | last post by:
hey all So I decided to be a little ambitious over the summer and create the game of clue in c. I figured it would give my self a GOOD refresher of the language and further understand functions...
9
by: Brian Dude | last post by:
Hello, I'm really at a loss as to what's going wrong with my code. I have it posted below. How it appears is how I had it originally. I've deleted all error-checking for simplicity: #include...
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
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
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: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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.