473,396 Members | 1,923 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,396 software developers and data experts.

Windows 98 C application - text boxes and "\n"

I'm creating a Dialog-Based Win32 file backup utility
for use with other application.
The problem is that I want to get the following in a
textbox:
doc1.txt: copied without errors.
doc2.txt: not copied!
doc3.txt: copied without errors.
doc4.txt: copied without errors.
but it does not recognize "\n". I had this problem in
Visual BASIC ( ~~ two years ago), and I didn't found re-
solution to it. Now, the problem remains the same, but
over Pelles C and in other application.

I anybody knows how to resolve this problem over C,
please tell me.

I'm using:
- Windows 98;
- Pelles C (this application uses WinAPI);
- MS-DOS "command /c copy" to backup the files.

Note: It shows "\n" as an unrecognized character. (shows
a black square).

--
Nuno Silva (aka NJSG)

=== - ===
My english isn't very good, because it isn't my first language. If you
found any mistake (or have problems understanding the post), tell me.
=== - ===
I have a 33.3 kbps Internet Dial-Up Connection.
Please wait by my replies with patience.

Nov 14 '05 #1
6 1767

"NJSG" <me@minenet.net> wrote in message

but it does not recognize "\n".
I anybody knows how to resolve this problem over C,
please tell me.

Note: It shows "\n" as an unrecognized character. (shows
a black square).

In C the sequence "\n" inserts the numerical value 13, which is ASCII for
newline (1).
However that is all that is special about this value - it happens to be used
for a newline marker. If you pass it to a function which treats 13 as
something else, for instance maybe a graphic or a foreign character, then
all your newlines will be replaced by that character.
This is what must have happened. The Windows functions you are calling
handle the ASCII alphanumerical characters as you want, but not the control
characters.
Probably what you need to do is strip the newlines out and represent them by
the way you lay out text manually. Instead of passing "O rose thou are
sick/nthe invisible worm" pass "O rose thou art sick", reposition the
cursor, and pass "the invisible worm".

Another possibility is that the Windows function is looking for the sequence
"/r/n".

(1) Pedant's point goes here.
Nov 14 '05 #2
NJSG wrote:
I'm creating a Dialog-Based Win32 file backup utility
for use with other application.
The problem is that I want to get the following in a
textbox:
doc1.txt: copied without errors.
doc2.txt: not copied!
doc3.txt: copied without errors.
doc4.txt: copied without errors.
but it does not recognize "\n". I had this problem in
Visual BASIC ( ~~ two years ago), and I didn't found re-
solution to it. Now, the problem remains the same, but
over Pelles C and in other application.

I anybody knows how to resolve this problem over C,
please tell me.

I'm using:
- Windows 98;
- Pelles C (this application uses WinAPI);
- MS-DOS "command /c copy" to backup the files.

Note: It shows "\n" as an unrecognized character. (shows
a black square).


First, note that "\n" is a string literal in C. Surely you mean '\n'
which is the newline character. C uses the single newline as the
line terminator.

Micro$oft, for historical reasons, uses two characters to terminate
a line; a '\r' and a '\n' or CR and LF. To the extent that Pelles C
is creating the text files, opening them with "w" mode or "wt" mode
rather than "wb", might add the CR for you.

--
Joe Wright mailto:jo********@comcast.net
"Everything should be made as simple as possible, but not simpler."
--- Albert Einstein ---
Nov 14 '05 #3
Malcolm wrote:
"NJSG" <me@minenet.net> wrote in message
but it does not recognize "\n".
I anybody knows how to resolve this problem over C,
please tell me.

Note: It shows "\n" as an unrecognized character. (shows
a black square).


In C the sequence "\n" inserts the numerical value 13, which is ASCII for
newline (1).
However that is all that is special about this value - it happens to be used
for a newline marker. If you pass it to a function which treats 13 as
something else, for instance maybe a graphic or a foreign character, then
all your newlines will be replaced by that character.
This is what must have happened. The Windows functions you are calling
handle the ASCII alphanumerical characters as you want, but not the control
characters.
Probably what you need to do is strip the newlines out and represent them by
the way you lay out text manually. Instead of passing "O rose thou are
sick/nthe invisible worm" pass "O rose thou art sick", reposition the
cursor, and pass "the invisible worm".

Another possibility is that the Windows function is looking for the sequence
"/r/n".

(1) Pedant's point goes here.


Pedant's point.
I think you will find that '\n' on ASCII systems translates to the
LF or linefeed character, 012, 0x0a or 10. The expression '\r' is
the CR or carriage return character, 015, 0x0d or 13.

--
Joe Wright mailto:jo********@comcast.net
"Everything should be made as simple as possible, but not simpler."
--- Albert Einstein ---
Nov 14 '05 #4

"NJSG" <me@minenet.net> wrote in message
news:40**********************@news.telepac.pt...
I'm creating a Dialog-Based Win32 file backup utility
for use with other application.


<snip>
Win32 programming is off-topic.

--
Jeff
comp.lang.c faq http://www.eskimo.com/~scs/C-faq/top.html
Nov 14 '05 #5
In article <40**********************@news.telepac.pt>, me@minenet.net says...
I'm creating a Dialog-Based Win32 file backup utility
for use with other application.


comp.os.ms-windows.programmer.win32

Nov 14 '05 #6
Malcolm wrote:
"NJSG" <me@minenet.net> wrote in message
but it does not recognize "\n".
I anybody knows how to resolve this problem over C,
please tell me.

Note: It shows "\n" as an unrecognized character. (shows
a black square).


In C the sequence "\n" inserts the numerical value 13,


No, in C the sequence "\n" produces an implementation-defined value or
values on the output stream, just as "a" or "1" does. Don't mislead the
poor sap.
Nov 14 '05 #7

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

Similar topics

7
by: Paul Rubin | last post by:
I'm writing a Windows program that needs to store some user files. The logical place to store them is in "Application Data", right? Is there a good way to find the correct location of that...
1
by: Neil Zanella | last post by:
Hello, I would like to use CSS to apply a width of 100% to all <input> elements, but to only those that have an type attribute set to "text", without affecting check boxes, radio buttons, etc......
11
by: Codemonkey | last post by:
Hi, I am writing an App in .Net that involves some scheduling of tasks. I was wondering if anybody has come accross any components or examples of how to implement a schedule manager like the one...
4
by: Darryl Kerkeslager | last post by:
Below is a section of the code I use to open Word with late binding, insert text at the selected bookmarks, and make Word visible. Everything works fine. However, I also have some Word check...
5
by: Rajat Tandon | last post by:
Hello Everybody, Please guide me so that I can fulfill this challenging assisnment ... I have been asked to "Restructure a Windows application" from scratch in 2 months. The existing...
10
by: Stuart Brierley | last post by:
Does anyone have any ideas how to open a new web browser window in .NET? I'm using ASP.NET with VB as the code behind, and after some (server side) validation code may need to open a second...
0
by: fred | last post by:
The Programmer Of The Month website poses an interesting programming challenge every so often. We don't have any prizes but we do offer a friendly forum and the opportunity to compete against...
1
by: reeferz | last post by:
hi all, i created the most basic webservice the one that vs 2005 creates for u with the hello world method, and decided to post it onto my website.... however i keep getting this error : ...
1
by: inungh | last post by:
I tried to place a grid view on my design view and connect to new data source to local SQL Express server Northwind database. I got error message on line 80 <authentication mode="Windows"/> ...
5
by: Stefano Tonello | last post by:
Hi all, I need to call windows' "open with" dialog from my C# windows form application. After the user selects application, control must return to me (I have to launch directly the process). I...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
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
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
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,...

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.