473,770 Members | 2,069 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1793

"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.program mer.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
11824
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 directory, preferably without any C extensions? It's ok if the directory is found at installation time rather than runtime, and bdist_wininst does have a way to find it from a post-installation script. The trouble is that the post-installation...
1
2938
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... How can this be accomplished with CSS? Thanks,
11
4087
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 in the Task Scheduler for Windows? Basically I'm after something that'll allow me to specify a "recurring" or "once off" schedule with advanced options like "the first monday in the month" etc.
4
8012
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 boxes, that I cannot figure out how to make 'checked'. I am not allowed to alter the layout of the form; it must be a check box. Up until now, I have simply required users to check the box themselves, but now I'm opening up four Word forms that all...
5
2002
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 application which is working but it is very heavy as no proper application architecture and layering has been followed for this. It was really hard to maintain (as I was maintaing it till now) . First let me tell u a bit about my application ...
10
1925
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 browser window. Any help gratefully received. Cheers
0
2539
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 fellow programmers. Hope you'll drop by and give us a look! The latest problem just began: http://dinsights.com/POTM/LINESANDBOXES describes a game called "LINES and BOXES" which is similar to "DOTS and BOXES".
1
28068
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 : <authentication mode="Windows" /> more detail: Server Error in '/' Application.
1
4158
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"/> The full error message is following: D:\websites\begaspnet2db\web.config(80): Build (web): It is an error to use a section registered as allowDefinition='MachineToApplication'
5
6208
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 found this solution: http://www.codeproject.com/KB/shell/openwith.aspx but it's not good for me since it will execute the process directly.
0
9454
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10101
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...
0
9906
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...
1
7456
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
6712
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
5354
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
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
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
3
2850
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.