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

C program works on W98 but not new WXP machine

Hi,

On my previous Windows 98 machine, I wrote a simple C program that takes
two text files as input, performs some calculations, then produces a
text file that contains the results. It worked fine on that machine.
Recently, however, I obtained a new Windows XP machine, and the program
is not working correctly on my new computer computer. On the new XP
machine, I'm running the program in the DOS window, as before, and the
program does execute and produce an output file, however the file is
empty.
I tried the following, but the results were unchanged:

1. Compiling it on the new machine

2. Changing the location of the input files, and thus the directory
path, so that there were no spaces in the path, i.e., the default path
contained "documents and settings." (The program, itself, is in a
folder that is accessible from any location, and I have used other
programs within this same folder with associated input files in other
locations and it works fine, so that isn't the problem)

3. Logging in as administrator to see if there was a permission problem

The program was created in Borland C++ 5.02.

Any ideas? Is there something obvious that I'm overlooking?

Thanks for your time.

DM
Nov 14 '05 #1
4 1470
Denise Mills wrote:
Hi,

On my previous Windows 98 machine, I wrote a simple C program that takes
two text files as input, performs some calculations, then produces a
text file that contains the results. It worked fine on that machine.
Recently, however, I obtained a new Windows XP machine, and the program
is not working correctly on my new computer computer. On the new XP
machine, I'm running the program in the DOS window, as before, and the
program does execute and produce an output file, however the file is empty.
I tried the following, but the results were unchanged:

1. Compiling it on the new machine

2. Changing the location of the input files, and thus the directory
path, so that there were no spaces in the path, i.e., the default path
contained "documents and settings." (The program, itself, is in a
folder that is accessible from any location, and I have used other
programs within this same folder with associated input files in other
locations and it works fine, so that isn't the problem)

3. Logging in as administrator to see if there was a permission problem

The program was created in Borland C++ 5.02.
Are you sure you use the compiler in C mode?
Any ideas? Is there something obvious that I'm overlooking?

Thanks for your time.


Your program seems to invoke undefined behavior, implementation-defined
behavior, or perhaps you have triggered a compiler bug (unlikely).

Please simplify the program to the smallest version that you'd expect to
work but doesn't. If this contains Windows-specific code, show it in a
windows-dedicated newsgroup. If it is (near-)standard C code, show it
here to have it scrutinized.

Best regards,

Sidney

Nov 14 '05 #2
"Denise Mills" <dm****@d.umn.edu> wrote in message
news:bv**********@lenny.tc.umn.edu...
Hi,

On my previous Windows 98 machine, I wrote a simple C program that takes
two text files as input, performs some calculations, then produces a
text file that contains the results. It worked fine on that machine.
Recently, however, I obtained a new Windows XP machine, and the program
is not working correctly on my new computer computer. On the new XP
machine, I'm running the program in the DOS window, as before, and the
program does execute and produce an output file, however the file is
empty.


The answer is simple. You know that Windows XP is the best thing since
sliced bread, right? And in its infinite wisdom, when the system loads
your program, it recognizes that it had been built with Borland C++ and
makes it misbehave like everything not supplied from Microsoft.

I'm just kidding, of course. Without looking at your source, there is no
other way to tell. Most likely you used void main() or some other instance
of undefined behaviour that "seemed to work" on one (version of) an OS
nut not on another. Share your code with the group and we'll see.

Peter
Nov 14 '05 #3
Denise Mills wrote:
machine, I'm running the program in the DOS window, as before, and the
program does execute and produce an output file, however the file is
empty.


This is a long shot, but look at your code and make sure you are closing
the file after you're done writing to it. Blank files sometimes means that
output files are not committed to disk (ie, you write to the file, but the
contents remain on cache because the changes have not been committed).

Otherwise, as others have said, post your code.

--
gabriel
Nov 14 '05 #4
On Tue, 3 Feb 2004, Denise Mills wrote:
Hi,

On my previous Windows 98 machine, I wrote a simple C program that takes
two text files as input, performs some calculations, then produces a
text file that contains the results. It worked fine on that machine.
Recently, however, I obtained a new Windows XP machine, and the program
is not working correctly on my new computer computer. On the new XP
machine, I'm running the program in the DOS window, as before, and the
program does execute and produce an output file, however the file is
empty.
The most likely problem is that your program APPEARED to work on Windows
98. It is not uncommon for new programmers to create programs with
undefined behaviour. Undefined behaviour means that anything can happen.
For example, on Windows 98 the program does what is expected. On Windows
XP it fails to create a file.
I tried the following, but the results were unchanged:

1. Compiling it on the new machine
Highly doubtful this would make a difference.
2. Changing the location of the input files, and thus the directory
path, so that there were no spaces in the path, i.e., the default path
contained "documents and settings." (The program, itself, is in a
folder that is accessible from any location, and I have used other
programs within this same folder with associated input files in other
locations and it works fine, so that isn't the problem)
Good guess. This is a common bug in an application.
3. Logging in as administrator to see if there was a permission problem
Another good guess.
The program was created in Borland C++ 5.02.

Any ideas? Is there something obvious that I'm overlooking?


I'm going to guess that you'll have to look at the code and REALLY
understand what it is doing. Look at the comp.lang.c FAQ to see if there
is anything in there to indicate what you might be doing wrong. The FAQ is
at www.eskimo.com/~scs/C-faq/top.html.

--
Send e-mail to: darrell at cs dot toronto dot edu
Don't send e-mail to vi************@whitehouse.gov
Nov 14 '05 #5

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

Similar topics

11
by: anuradha.k.r | last post by:
hi, i am writing a socket program in python,both client side and server side.I've written the client side which is working perfectly fine(checked it against server program written in C).but as for...
3
by: Radioflyer651 | last post by:
I've been working on a problem which has me totally confused. My application is checking a collection of objects to see if they have a difference in one of it's properties. If it does, it's...
8
by: G Patel | last post by:
I wrote the following program to remove C89 type comments from stdin and send it to stdout (as per exercise in K&R2) and it works but I was hoping more experienced programmer would critique the...
0
by: joeted | last post by:
Hi, I am using system.diagnostic.process with the intention of running a program to communicate with a unix box: The program is "PuTTY", running from a batch script. I know it works because...
29
by: tele-commuter | last post by:
Hi folks, I want to understand how exactly is an image(compiled c code and loaded into memory) stored in memory. What exactly is a linker script? I work with a lot of c code on a daily...
3
by: sir.linying | last post by:
My php script is to call perl scipt which makes use of Spreadsheet::ParseExcel module to parse Excel file. I am able to launch php script from command line so that perl script can run and properly...
5
by: Igor | last post by:
Hi! We built VB6 application to work with Reporting Services server. To connect to reporting server has been created a special assembly with .NET VS2003. While we execute our program on local...
8
by: id10t error | last post by:
Hi, I am sorry that my description is not better but it is hard to think of one for this problem. I have a program on the user computer and I need to only let them have one instants of this...
6
by: John O'Flaherty | last post by:
Hello. I have an ms acess database that I use to track my mp3 files. I have included code that lets me select and play files by invoking an mp3 player (Winamp). This is done by using visual basic...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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...
0
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
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...

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.