473,498 Members | 1,992 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problems with FILE pointers

84 New Member
Hi everyone! I am currently experiencing some problems... My program crashes when i open a file which does exist. The problem seems to happen when two pointers point at the same file. Could it be the reason why my program's crashing?

Paul. Thanks a lot.
Oct 18 '07 #1
2 1469
gpraghuram
1,275 Recognized Expert Top Contributor
Hi everyone! I am currently experiencing some problems... My program crashes when i open a file which does exist. The problem seems to happen when two pointers point at the same file. Could it be the reason why my program's crashing?

Paul. Thanks a lot.
Hi,.
Is the program crashing during opening the file or during any file operations when u do with the file pointer.
Usuallu fopen wont crash.
After opening the file check for NULL and then do the file operations.

Raghuram
Oct 19 '07 #2
sanYAua007
6 New Member
Hi.
It is the reason of program crashing, because when you assign your pointer with file, using fopen() system closes previous connection to this file. So when you try to use it later, you get crash.

Expand|Select|Wrap|Line Numbers
  1. ........
  2. f1=fopen();
  3. f2=fopen();//after this f1 points to nowhere
  4. ........
  5.  
Oct 19 '07 #3

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

Similar topics

2
3292
by: Keegan Alex | last post by:
Hi folks, I downloaded PHP-Nuke 6.7, and after reading the INSTALL file, it looks very simple... but either i'm reading them wrong or they're very flawed. First, it says: Untar the package...
20
2184
by: Lucas Raab | last post by:
I'm done porting the C code, but now when running the script I continually run into problems with lists. I tried appending and extending the lists, but with no avail. Any help is much appreciated...
1
3326
by: Ace Alexander | last post by:
I searched the internet and this news group and am still having problems grasping this concept. I have: struct file { bool open; vector<file*>my_files; }; I initialize a file: file...
5
2505
by: Sona | last post by:
I understand the problem I'm having but am not sure how to fix it. My code passes two char* to a function which reads in some strings from a file and copies the contents into the two char*s. Now...
33
2989
by: wespvp | last post by:
When I try to run thread_test.c from the CVS tip, it hangs in an infinite CPU loop on both linux (RedHat AS 3.0, gcc 3.2.3) and Mac OS X 10.3.3 (gcc 3.3). I've also tried down to gcc 2.96 on Mac...
2
1936
by: raylopez99 | last post by:
I'm having problems compiling complex reference declarations in MSVC++.NET 2002 IDE. Here is an example: // --Foo.h-- #include "Bar.h" class Bar; //forward decl. to a class Bar in...
2
3249
by: Mike | last post by:
Hi, I am new to C and having problems with the following program. Basically I am trying to read some files, loading data structures into memory for latter searching. I am trying to use structres...
9
1578
by: olf | last post by:
Hello all, I have very recently trying to make a small program in c++ and I am having problems with pointers. I want to read a line from a file, send that line to a function that parses and...
84
3430
by: jacob navia | last post by:
As many people know, I think that garbage collection is a good solution for many memory allocation problems. I am aware however, that nothing is "the silver bullet", not even the GC. A recent...
0
7125
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7165
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,...
1
6885
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...
0
5462
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,...
0
4588
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...
0
3093
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...
0
1417
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
656
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
290
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...

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.