473,799 Members | 3,085 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

What is wrong with this. (files)

Okay. I'm quite embarased to be asking this but I cannot seem to get
files to work. I don't know what the problem is. Is there something
wrong with this: (file related)

#include <stdio.h>
main() {
FILE *pfsin;
pfsin = fopen("msm.pfs" , "r");
char mystr[100];

fscanf(pfsin, "%s", mystr);
fclose(pfsin);
}

Thanks in advanced, but I have seen several examples of code that looks
EXACLTY like this, and for some reason my compiler is giving me
rediculus errors.
Nori

May 16 '06
22 2294
Richard Heathfield wrote:
jab3 said:
pete wrote:
With trouble shooting in general,
be it either automotive or programming,
when somebody tells you that they've got a problem
and that they know what the problem definitely isn't,
then that's the first place I want to start looking.
My experience is that there is about 50% chance
that that's the problem.


pete - that jibes pretty well with my experience, too, although I'd have
put the probability somewhat higher.
Since any given statement either is or is not a problem, any given
statement has a 50% chance of being the problem.


If you truly believe that two mutually exclusive possibilities are
necessarily of equal probability, I offer you the following bet:

Given suitable precautions to prevent cheating, you will put down $5000
and I will put down $10000 - so there's $15000 on the table - and then a
trusted third party will put a hundred fair coins (one side heads, the
other side tails) into a sack, shake 'em around a bit, and then spill them
onto a tabletop. Either they will all come out heads, or they won't, so
that's 50-50, right? So - if they all come down heads, you get to keep the
$15000, despite only a $5000 stake. That's good odds for you. If the other
50% chance happens, though, I get the $15000 instead.

Deal?


Well, I don't think my statement works given real probability analysis. (It
was late and the 50% chance comment just struck me as funny) However, I
also don't think your bet is strictly analogous to what I said. I didn't
say the whole program is either all right or all wrong. I said any given
line theoretically has a 50% chance of being right or wrong. Your bet, were
it analogous, would be that any given coin has a 50% chance of being either
heads or tails. But I would imagine the actual probability of any given
line of code being right or wrong is based on the person doing the coding,
the language, the complexity of the program, the emotional state of the
person, etc.

May 18 '06 #21
jab3 wrote:

Richard Heathfield wrote:
jab3 said:
pete wrote:

With trouble shooting in general,
be it either automotive or programming,
when somebody tells you that they've got a problem
and that they know what the problem definitely isn't,
then that's the first place I want to start looking.
My experience is that there is about 50% chance
that that's the problem.
pete - that jibes pretty well with my experience, too,
although I'd have
put the probability somewhat higher.

the 50% chance comment just struck me as funny


http://www.google.com/

Results 1 - 10 of about 76,500 for "it's funny because it's true".

--
pete
May 18 '06 #22
jab3 said:
Well, I don't think my statement works given real probability analysis.
No, it doesn't.
(It
was late and the 50% chance comment just struck me as funny) However, I
also don't think your bet is strictly analogous to what I said. I didn't
say the whole program is either all right or all wrong. I said any given
line theoretically has a 50% chance of being right or wrong.


But in fact, if we know there is one bug in an N-line program, then (if
that's all the information we have to go on) each line has a 1/N
probability of containing that bug. 1/N is only 50% if it's a two-line
program.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
May 18 '06 #23

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

Similar topics

125
14863
by: Sarah Tanembaum | last post by:
Beside its an opensource and supported by community, what's the fundamental differences between PostgreSQL and those high-price commercial database (and some are bloated such as Oracle) from software giant such as Microsoft SQL Server, Oracle, and Sybase? Is PostgreSQL reliable enough to be used for high-end commercial application? Thanks
30
9601
by: RC | last post by:
I want to do <hr noshade size="5" width="80%"> by use CSS instead HTML. I try <style type="text/css"> HR { size: 5px; width: 80%; length: 5px; height: 5px; border-style:padding: 0}
5
2839
by: titan0111 | last post by:
#include<iostream> #include<iomanip> #include<cstring> #include<fstream> using namespace std; class snowfall { private: int ft;
121
10188
by: typingcat | last post by:
First of all, I'm an Asian and I need to input Japanese, Korean and so on. I've tried many PHP IDEs today, but almost non of them supported Unicode (UTF-8) file. I've found that the only Unicode support IDEs are DreamWeaver 8 and Zend PHP Studio. DreamWeaver provides full support for Unicode. However, DreamWeaver is a web editor rather than a PHP IDE. It only supports basic IntelliSense (or code completion) and doesn't have anything...
2
5745
by: Qiao Yun | last post by:
I used vc++.net (visual studio .net ) to open a project which can work well in vc++6.0. I succeeded in compiling the project in vc++.net in release mode . But when I tried to compile the project in debug mode, the following errors happened: d:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xdebug(29): error C2365: 'new' : redefinition; previous definition was a 'member function' d:\Program Files\Microsoft Visual Studio...
2
3618
by: Rod | last post by:
I've been struggling with this thing for 2 days, and after searching the 'net for help, I cannot find what is wrong. We're using Crystal Reports XI Release 2, with Visual Studio .NET 2003 in an ASP.NET 1.1 application. I've got a CrystralReportsViewer control on an ASP.NET page. Once the page gets hit I get the following error message (this is running on my development machine):
7
1748
by: Altemir | last post by:
SOME BACKGROUND: I am new to ASP.NET, but somehow managed to install a perfectly working ..aspx page on our production server that I compiled in Visual Studio. However, I recently needed to update it, so I first added a ".old" suffix to the MyPage.aspx, MyProject.dll, and global.asax files on the production server so I had a backup copy of the original files in case something went wrong. Indeed, something did go wrong when I installed...
1
1446
by: x40 | last post by:
I try to learn python thru solving some interisting problem, found google trasure hunt, write first program ( but cant find whats wrong). # Unzip the archive, then process the resulting files to obtain a numeric result. You'll be taking the sum of lines from files matching a certain description, and multiplying those sums together to obtain a final result. Note that files have many different extensions, like '.pdf' and '.js', but all...
12
1856
by: vijayarl | last post by:
Hi All, Thanks in Advance !!!! I have one config file & am reading that file.later i am using one of the value specified in the config file & trying to get the files placed in the directory into the array. problem is when i try to print the array varaible it doesn't hold any value even though i have placed some files under searching directory... don't know where it's going wrong ??? can any one help me on this ???
5
1091
by: Timothy Madden | last post by:
Hello I see there is now why to truncate a file (in C or C++) and that I have to use platform-specific functions for truncating files. Anyone knows why ? I mean C/C++ evolved over many years now, and still, people making _the_ standards never decided to include such a function. Even in POSIX it was included only in recent versions, mostly not fully supported yet.
0
10484
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
10251
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
10228
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,...
1
7565
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
5463
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
5585
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4141
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 we have to send another system
2
3759
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2938
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.