473,626 Members | 3,325 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

File Handling in C++

Parul Bagadia
188 New Member
This is my first program of file handling...
Here we are supposed to simulate sql language......
This is ofcourse not the complete program; m done only with insertion and select* thing; insert thing is workin properly but in case of select*; nothing gets displayed; but when i checked it in debugger; it was ok. I mean the object of class student has the information but it doesnt get displayed...
May be the information m writtin in file is not actually not gettin written in file. I dont know the actual problem; that's what i want to know.
Now m gettin another error when m done with running it.
The errror comes as:
16 bit MS-DOS subsystem
Turbo C++ IDE
The NTVDM CPU has encountered an illegal instruction CS:8baa IP:2e32 OP:c6 5f 5e 5d c3 choose close to terminate the application.

Tell me sth about this in details.
The compiler m using is of Turbo C++ IDE.
Expand|Select|Wrap|Line Numbers
  1. Full Code (125 lines) removed, please read Posting Guidelines
Jul 28 '08 #1
6 3513
Parul Bagadia
188 New Member
Hi,
When i wrote the same code in Microsoft Visual C++ 6.0. i dont get SQL> as written in the code.. Its always coming after i input the line.. And moreover its comin randomly..
Sometimes its comin 4 times in a row.
Can somebody tell me why is this happening.
Jul 28 '08 #2
Parul Bagadia
188 New Member
In the same code when i wrote
while(enter[i]!=' ')loop
it worked. and when i wrote while(enter[i]!=' ' || enter[i]!='\n')it never used to come out of the loop.... i checked it even by debugger...
I want to know its reason as well.
Jul 28 '08 #3
Savage
1,764 Recognized Expert Top Contributor
In the same code when i wrote
while(enter[i]!=' ')loop
it worked. and when i wrote while(enter[i]!=' ' || enter[i]!='\n')it never used to come out of the loop.... i checked it even by debugger...
I want to know its reason as well.

The reason is that you have used OR instead of AND,so if any of those two expressions succeed it will loop again.Obviously enter[i] can't be ' ' and '\n' in same which is required to exit from the while loop when OR logic is used.
Jul 28 '08 #4
Parul Bagadia
188 New Member
The reason is that you have used OR instead of AND,so if any of those two expressions succeed it will loop again.Obviously enter[i] can't be ' ' and '\n' in same which is required to exit from the while loop when OR logic is used.
Yaeh, actually i got it when i again debugged it but still its not working..
I guess now there can be some problem in gettin inserted in file..
I really dont know why its comin out of while loop of selectall function.,
Jul 30 '08 #5
Parul Bagadia
188 New Member
Hey people, am waitin to know wats wrong with my code...
Jul 31 '08 #6
Laharl
849 Recognized Expert Contributor
Can we have a snippet of the code that's having a problem? Not the whole code, but a bit, say, this while loop you mention.
Aug 1 '08 #7

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

Similar topics

9
3197
by: Hans-Joachim Widmaier | last post by:
Hi all. Handling files is an extremely frequent task in programming, so most programming languages have an abstraction of the basic files offered by the underlying operating system. This is indeed also true for our language of choice, Python. Its file type allows some extraordinary convenient access like: for line in open("blah"): handle_line(line)
1
3259
by: Sean W. Quinn | last post by:
Hey folks, I have a question regarding file handling, and the preservation of class structure. I have a class (and I will post snippets of code later in the post) with both primitive data structures (ints), and more complex data structures (strings and vectors) in it, and would like to write the entire class to a data file that could then be read back and loaded. However I'm having difficulty with this -- I found out (due to an...
5
2280
by: John Douglass | last post by:
I'm fairly new to doing involved file i/o and I came across something weird with a program I'm writing (modifying MIDI data, if it makes any difference). With some input files, when I modify data and then output to a new file, the program will crash. The catch is that when I open up the output file to see what the program managed to write, it always makes it to an offset of xFFF. For example, with one file it crashed at 2FFF, another at...
8
26707
by: Gabe Moothart | last post by:
Hi, I'm writing a windows service which interacts with a separate process. Basically, it calls a process which creates a file, and then my service reads that file. The problem is, the external process can take a second or two to finish writing the file. If I try to read the file to soon, I get an exception that "The process cannot access the file because it is being used by another process". I could just set a timer, but the time it...
14
3876
by: Al Smith | last post by:
I need help in implementing proper error handling. I am trying to upload a file based on the sample code below. The code works well except if the file selected is too big. I do know about the maxRequestLength parameter of the <httpRuntime> section and that works as expected. What I want is to enforce a max file size but haven't been able to trap the error thrown when the file is too large and that's where I could use some help.
1
6473
by: laredotornado | last post by:
Hi, I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed using Apache's apxs and the php library was installed to /usr/local/php. However, when I set my "error_reporting" setting to be "E_ALL", notices are still not getting reported. The perms on my file are 664, with owner root and group root. The php.ini file is located at /usr/local/lib/php/php.ini. Any ideas why the setting does not seem to be having an effect? ...
5
4059
by: Digital Puer | last post by:
I fixed a bug today that went against my intuition. I am on Linux. I had a class that fopen'ed some files. When I called delete on these objects, I expected that the files would be closed automatically, just as when an application terminates, but evidently this is not the case. I guess I have to fclose the files in the destructor. Is this a correct assessment?
19
4767
by: rmr531 | last post by:
First of all I am very new to c++ so please bear with me. I am trying to create a program that keeps an inventory of items. I am trying to use a struct to store a product name, purchase price, sell price, and a taxable flag (a Y/N char) and then write this all out to a file (preferably just a plain old text file) and then read it in later so that I can keep a running inventory. The problem that I am running into is when I write to the...
5
64616
AdrianH
by: AdrianH | last post by:
Assumptions I am assuming that you know or are capable of looking up the functions I am to describe here and have some remedial understanding of C++ programming. FYI Although I have called this article “How to Parse a File in C++”, we are actually mostly lexing a file which is the breaking down of a stream in to its component parts, disregarding the syntax that stream contains. Parsing is actually including the syntax in order to make...
5
6802
by: kailashchandra | last post by:
I am trying to upload a file in php,but it gives me error msg please Help me? My Code is like below:- i have one php file named upload.php and i have another html file named upload.html and inside html i am calling php file upload.php:- <?php
0
8705
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
8638
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
8365
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
8505
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
7196
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...
1
6125
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
5574
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
4198
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1811
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.