Sponsored Content
Full Discussion: strange situation in file
Top Forums Programming strange situation in file Post 302145183 by arunkumar_mca on Tuesday 13th of November 2007 05:09:23 AM
Old 11-13-2007
strange situation in file

Hi All,

I am writing some data's into a file from C++ program. The files which i am writing is of fixed length . say 232 in length per line.
I am writing as . my c code is as

sprintf(szData,"%-12s%-30s%.4d%-30s",m_UpcCode.data(),m_UpcDescription.data(),m_nModuleNumber,m_ModuleDescription.data());
sprintf(szData1,"%.6d%-30s%-6s%-30s%-3s",m_nBrandCode,m_BrandDescription30.data(),m_SizeCode.data(),m_SizeValue.data(),m_MultiValue.data( ));
sprintf(szData2,"%-6s%-30s%-1s%-4s",m_FlavorCode.data(),m_FlavorDescription.data(),m_Blank.data(),m_ProductGroupCode.data());
sprintf(szData3,"%.4d%.4d%-8s%-6s%-6s%-6s%-6s",m_nTgmModuleNumber,m_nTgmProductGroupCode,m_OldestSalesDate.data(),m_ContrCharCode.data(),m_Genr eCharCode.data(),m_VdfmtCharCode.data(),m_TypeCharCode.data());
sprintf(szSharpUpcData,"%s%s%s%s",szData,szData1,szData2,szData3);
pRdhFileApp->writeData(szSharpUpcData);




But after the file operation finished when i cheked the file the file is not in
fixed line length there are some junk character after the new line ("\n")
i mean that some lines are with 232 in length and some are with 233 in length . When i tried convert the line into HEXA decimamal value it is showing a apecial charater 00.

Why that is happening . PLease let me know

Thanks,
Arun
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

A Challenging situation for the MODERATORS

Well, I hope this way you will respond to my inquiries. I have 4 unix servers,with static ips (though i dont think this is an issue)....i can telnet and rlogin from one to the other....if i FTP from on et othe other and try to execute : cd /user return /user : no such file or... (1 Reply)
Discussion started by: BAM
1 Replies

2. UNIX for Dummies Questions & Answers

strange situation with nslookup on Linux

Hey, I have a problem with nslookup under the newly installed mandrake 9.1, and as I see now also under Redhat 8.0 I have a pc called evo with the ip 10.0.0.1 which entered correctly in the /etc/hosts file. Connection to the internet is via an adsl-router. I have the nameservers from my... (2 Replies)
Discussion started by: mod
2 Replies

3. UNIX for Advanced & Expert Users

current situation

hello..what is the current situation or lastest version of UNIX?? Is there any where i can read more about it?? (2 Replies)
Discussion started by: joanne6298
2 Replies

4. Filesystems, Disks and Memory

Strange difference in file size when copying LARGE file..

Hi, Im trying to take a database backup. one of the files is 26 GB. I am using cp -pr to create a backup copy of the database. after the copying is complete, if i do du -hrs on the folders i saw a difference of 2GB. The weird fact is that the BACKUP folder was 2 GB more than the original one! ... (1 Reply)
Discussion started by: 0ktalmagik
1 Replies

5. Shell Programming and Scripting

sed situation

Hi, I'm looking for someone who can think in sed. Basically, I need the trailing characters on every line in a file to be deleted. These characters are all in capitals, and always follow a number, but they often vary in number For instance, on the line: 2006_10_9_p20_TALK I'd want to... (4 Replies)
Discussion started by: Laurel Maury
4 Replies

6. Shell Programming and Scripting

How to Sort a file for given situation?

Hi All, How can you sort a file that is doubled space ( where even number lines are blank lines) and still preserves the blank lines? You can use grep,sed and regular expression. Thanks Vishal (4 Replies)
Discussion started by: vishalpatel03
4 Replies

7. UNIX for Dummies Questions & Answers

help : crisis situation !!

Hi I had deleted important files from my company server :( the server is HPUX and i don't know how to undo rm command or how to restore the files .. iam appreciate for any help Thanx ... (5 Replies)
Discussion started by: Eisa
5 Replies

8. Shell Programming and Scripting

Strange situation of file sorting and merging

I have a strange situation of sorting and merging two files based on similar columns previusly both files has same count of records so, I made below way which is working fine until they reduced the count of one files . I.e. some times the count of records of both will same and some times it... (16 Replies)
Discussion started by: manas_ranjan
16 Replies

9. HP-UX

Tricky situation getting IP address

Hi, I have a multihomed system HP-UX with two NIC cards having IP address 10.9.0.13 & 10.9.0.45 I have two weblogic servers running one listening on "10.9.0.13" and the other on "10.9.0.45" Given a PID how is it possible to extract the IP Address that the weblogic server is using and... (1 Reply)
Discussion started by: mohtashims
1 Replies

10. Shell Programming and Scripting

Have a situation while extracting info

i have a text file which i am generating from few sqls. format is like : col1 col2 col3 col4 col5 1001 DONE ABC 17-sep-14 12:02:05 1001 DONE ABC 17-sep-14 12:02:05 1001 DONE ABC 17-sep-14 12:02:55 1001 REDONE ABC ... (6 Replies)
Discussion started by: deepakiniimt
6 Replies
CUBRID_PCONNECT(3)							 1							CUBRID_PCONNECT(3)

cubrid_pconnect - Open a persistent connection to a CUBRID server

SYNOPSIS
resource cubrid_pconnect (string $host, int $port, string $dbname, [string $userid], [string $passwd]) DESCRIPTION
Establishes a persistent connection to a CUBRID server. cubrid_pconnect(3) acts very much like cubrid_connect(3) with two major differences. First, when connecting, the function would first try to find a (persistent) link that's already open with the same host, port, dbname and userid. If one is found, an identifier for it will be returned instead of opening a new connection. Second, the connection to the SQL server will not be closed when the execution of the script ends. Instead, the link will remain open for future use (cubrid_close(3) or cubrid_disconnect(3) will not close links established by cubrid_pconnect(3)). This type of link is therefore called 'persistent'. PARAMETERS
o $host -Host name or IP address of CUBRID CAS server. o $port -Port number of CUBRID CAS server (BROKER_PORT configured in $CUBRID/conf/cubrid_broker.conf). o $dbname -Name of database. o $userid -User name for the database. o $passwd -User password. RETURN VALUES
Connection identifier, when process is successful. FALSE, when process is unsuccessful. EXAMPLES
Example #1 cubrid_connect(3) example <?php printf("%-30s %s ", "CUBRID PHP Version:", cubrid_version()); printf(" "); $conn = cubrid_pconnect("localhost", 33000, "demodb", "dba"); if (!$conn) { die('Connect Error ('. cubrid_error_code() .')' . cubrid_error_msg()); } $db_params = cubrid_get_db_parameter($conn); while (list($param_name, $param_value) = each($db_params)) { printf("%-30s %s ", $param_name, $param_value); } printf(" "); $server_info = cubrid_get_server_info($conn); $client_info = cubrid_get_client_info(); printf("%-30s %s ", "Server Info:", $server_info); printf("%-30s %s ", "Client Info:", $client_info); printf(" "); $charset = cubrid_get_charset($conn); printf("%-30s %s ", "CUBRID Charset:", $charset); cubrid_disconnect($conn); ?> The above example will output: CUBRID PHP Version: 9.1.0.0001 PARAM_ISOLATION_LEVEL 3 LOCK_TIMEOUT -1 MAX_STRING_LENGTH 1073741823 PARAM_AUTO_COMMIT 1 Server Info: 9.1.0.0212 Client Info: 9.1.0 CUBRID Charset: iso8859-1 SEE ALSO
cubrid_connect(3), cubrid_connect_with_url(3), cubrid_pconnect_with_url(3), cubrid_disconnect(3), cubrid_close(3). PHP Documentation Group CUBRID_PCONNECT(3)
All times are GMT -4. The time now is 02:51 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy