473,545 Members | 2,005 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ios::binary issue

10 New Member
Hi, I'm a little stuck,

I basically need to copy all the information within a specific file in Temp and append it to a file in another location.

I'm not having any problems with smaller size log files stored within temp foldier and everything reads and appends perfectly, however when i try to read and append from IS12Install.log file in Temp all it appends to my destination file is:

ÿþ=
and a whole bunch of empty lines

I believe that this is an encoding issue..
I thought that i might solve this by using the binary read and binary write(append) ios::binary to get around this issue...

1) Why is this happening? I've noticed that the log file is 2.5mb might this be the issue?

2) Will ios::binary solve this issue?

3) If i do read and write(append) binary what i need to do to convert the binary back to letters before i write(append) the information?

4) Any other ideas of what might be happening and how to solve this issue?

Here is a chunk of my code:

//OPEN BOTH SOURCE AND DESTINATION FILES FOR READING AND WRITING/APPENDING
fstream file_in(SrcFile ,ios::in);
fstream file_out(DestFi le,ios::app);

//READ FROM SOURCE FILE
//APPEND EVERYTHING TO DESTINATION
char str[2000];

while(!file_in. eof())
{
file_in.getline (str,2000);
file_out << "\n" << str;
}
file_out << endl;

//CLOSE BOTH SOURCE AND DESTINATION FILES
file_in.close() ;
file_out.close( );

Thanks in advance
Alex
Sep 14 '06 #1
1 3256
AlekseyUS
10 New Member
Ok apparently i found out more about what is happening:

the .log file that i'm having problems with is in Unicode... so i have to read the Unicode line by line convert it to normal characters and write it to my Destination Log File...

I was told that unless i use cstring i won't be able to read the Unicode correctly...is this true?

Also what would be the best way going about doing what i described?

Thanks for all the help

Alex
Sep 15 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
2686
by: WahJava | last post by:
Hi developers, I'm running GCC (GNU C/C++ Compiler shipped with Fedora Core 2). I've written a program using IOStream classes, in which I'm reading files in ios::binary mode. I'm using read() method (exact signature not remembered) of the std::istream class ? When I'm reading the value in objects attribute (member variable), the read fails,...
103
48509
by: Steven T. Hatton | last post by:
§27.4.2.1.4 Type ios_base::openmode Says this about the std::ios::binary openmode flag: *binary*: perform input and output in binary mode (as opposed to text mode) And that is basically _all_ it says about it. What the heck does the binary flag mean? -- If our hypothesis is about anything and not about some one or more particular things,...
9
3671
by: Ron Eggler | last post by:
Hi, I would like to write binary data in a file i open (ofstream) with ios::binary but it keeps failing and it gives me a segmentation fault. What I'm exactly doing: if (isBinary == true) { std::cout << "open(" << filename.c_str() << ", std::ios::binary | std::ios::trunc);" << std::endl;
5
3628
by: ishould | last post by:
My actual problem is much larger but figuring out how to do this example will help me. I want to overwrite data that already exists in a text file but I can't seem to do this. ex. I have five fingers. My current code: ofstream File;
0
7411
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...
0
7669
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7926
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...
0
7773
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...
1
5343
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...
0
4962
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...
0
3450
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1901
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
0
722
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...

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.