Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

converting null to " "

Posted on 1998-10-23
5
Medium Priority
?
158 Views
Last Modified: 2010-04-30
I have a user defined type with fixed length strings.  When I print out to a file, if the string is empty, it is putting null characters in the file.  I need it to just have empty spaces.  I have tried reading each character using IsNull and check and replacing with " ", but it didn't work.  How do I get it to print out the file with empty spaces and not nulls?
0
Comment
Question by:LJ083198
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 12

Accepted Solution

by:
mark2150 earned 60 total points
ID: 1441316
You shouldn't be getting "null" characters You should be getting *no* characters.

Try:

IF LEN( MyString ) < 1 THEN MyString = Space$( n )

where N is number of bytes to fill
0
 
LVL 2

Expert Comment

by:BergJC
ID: 1441317
Can you show your code? How are you writing it out to the file currently?
0
 

Author Comment

by:LJ083198
ID: 1441318
Mark2150's solution would certainly work, but I have over 80 fields in each record of which half might be empty.  I was looking for a way to  check the whole thing for null and replace with a space, without doing each field individually.  
In response to BergJC I aam using a print# command.  When the file is opened it looks fine, and it has all it's spaces.  The problem comes when the file is used in the next application, the null are picked up as spaces.  They are essentially eliminated from the file.
0
 
LVL 2

Expert Comment

by:BergJC
ID: 1441319
Do you have control over the next application? This might be something that could be solved in the receiving application. Assuming, of course, that you do have control over the receiving app, which may not be the case.
0
 

Author Comment

by:LJ083198
ID: 1441320
unfortuantely no, I don't have control over the next application.
0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question