473,503 Members | 10,322 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Esay Problem about "std::getline"

i use std::getling to read a line in unicoude file to buffer,like:
WCHAR buf[100]
wifstream in;
std::getling(buf,in,100);

but i can't get the right result,it seems can only read by 1 byte;e.g first
word of unicode file is "0xfffe" ,if use getline ,it may 0x00ff 0x00fe in my
buffer

do you have any idea,except use c lib like fgetws
Nov 17 '05 #1
2 1960
aGAric wrote:
i use std::getling to read a line in unicoude file to buffer,like:
WCHAR buf[100]
wifstream in;
std::getling(buf,in,100);

but i can't get the right result,it seems can only read by 1 byte;e.g first
word of unicode file is "0xfffe" ,if use getline ,it may 0x00ff 0x00fe in my
buffer

do you have any idea,except use c lib like fgetws


aGAric:

It would be nice if you would post a typo-free (preferably compilable)
example, so we could tell what you really did.

But, for starters, std::getline does not take a buffer; it takes a string.

HTH,

David Wilkinson

Nov 17 '05 #2
Dear Wilkinson,

thank you for you advice.
i am a new programmer.
"David Wilkinson" <no******@effisols.com>
??????:uC**************@TK2MSFTNGP14.phx.gbl...
aGAric wrote:
i use std::getling to read a line in unicoude file to buffer,like:
WCHAR buf[100]
wifstream in;
std::getling(buf,in,100);

but i can't get the right result,it seems can only read by 1 byte;e.g first word of unicode file is "0xfffe" ,if use getline ,it may 0x00ff 0x00fe in my buffer

do you have any idea,except use c lib like fgetws


aGAric:

It would be nice if you would post a typo-free (preferably compilable)
example, so we could tell what you really did.

But, for starters, std::getline does not take a buffer; it takes a string.

HTH,

David Wilkinson

Nov 17 '05 #3

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

Similar topics

5
3216
by: Denis Petronenko | last post by:
Hello, how can i read into strings from ifstream? file contains values in following format: value11; val ue12; value 13; valu e21;value22; value23; etc. i need to read like file >string,...
4
2795
by: Chen shuSheng | last post by:
I have a code: --------------------------- #include <iostream.h \\ where I assume getline() is inner. #include <stdlib.h> int main() { int max=15; char line; getline(line,max);...
9
4973
by: Robin | last post by:
// Pls note that test.txt exists. #include <iostream> #include <fstream> #include <string> using namespace std; int main() { fstream fs("test.txt", ios_base::in | ios_base::app);
4
4128
by: =?Utf-8?B?Y2xlb2ht?= | last post by:
Hi, I have a C++ application that calls a function in another static library which accepts a std::string parameter. However, my VS 2005 compiler shows the following error: ...
7
3589
by: Ziyan | last post by:
I am writing a C/C++ program that runs in background (Linux). Therefore, normally no output would be written into standard output. However, sometimes I want to have debug message collected and sent...
6
2367
by: bryant058 | last post by:
#include<iostream> #include<cstring> #include<string> #include<iomanip> using namespace std; int main() { string s; char *tokenptr; int space;
15
2977
by: waltbrad | last post by:
Hello. I'm studying the book "C++ Primer Plus" by Stephan Prata. In chapter 6 he gives an exercise that reads from a file. The list is thus: 4 Sam Stone 2000 Freida Flass 100500 Tammy...
3
4911
by: caoliangbj | last post by:
Hi, When I capture the SIGINT event, I encounter a probelm. Please look at the following code, if you don't press any key, the 'getline()' will block there all the time. When I press...
2
1722
by: Juha Nieminen | last post by:
I assume that using '\n' to print a newline is not portable because in some systems newline consists actually of two characters and '\n' is only one. Thus the only portable way of printing a...
0
7207
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7095
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
7361
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...
1
7015
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
5602
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,...
0
4693
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...
0
3173
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1523
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 ...
1
749
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.