Click here to Skip to main content
16,006,440 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: scanf () loop question. Question withdrawn Pin
C_Zealot30-Apr-07 17:51
C_Zealot30-Apr-07 17:51 
GeneralRe: scanf () loop question. Question withdrawn Pin
Eytukan30-Apr-07 21:58
Eytukan30-Apr-07 21:58 
GeneralRe: scanf () loop question. Question withdrawn Pin
C_Zealot30-Apr-07 22:29
C_Zealot30-Apr-07 22:29 
GeneralRe: scanf () loop question. Question withdrawn Pin
James R. Twine1-May-07 2:34
James R. Twine1-May-07 2:34 
QuestionRe: scanf () loop question. Pin
David Crow1-May-07 2:16
David Crow1-May-07 2:16 
QuestionRe: scanf () loop question. Pin
James R. Twine1-May-07 2:40
James R. Twine1-May-07 2:40 
AnswerRe: scanf () loop question. Pin
David Crow1-May-07 2:52
David Crow1-May-07 2:52 
QuestionNeed some suggestions. C programming Pin
C_Zealot30-Apr-07 16:33
C_Zealot30-Apr-07 16:33 
Hi:

Below is the function I have been trying to write:
What I try to achieve is that:

1: Read one char at a time from a file pointed by fp.
2: A word consists of only alphabetic char or underscore '_'.
3: Store the word in a local_buffer.
4: Copy the word into a global_buffer and return it to the caller function.

The outcome I expect is:
Say, fp pointing to a text file 'Hello World, What is up??".
The outcome I expect is: (My function returns one word at a time.)
Hello
World
What
is
up
But the outcome I got is:
Hello
World


What
is
up

It seems that my function can not deal with successive 'space' properly. I am wondering why?

while((ch_read = fgetc(fp)) != 32) {
if (ch_read == EOF) {
EOF_Reached = TRUE;
strncpy (global_buffer, local_buffer, count);
global_buffer[count] = '\0';
return global_buffer;
}
if ((isalpha(ch_read) != 0)||(ch_read == '_')) {
local_buffer[count] = ch_read;
count++;
}
}
}
strncpy (global_buffer, local_buffer, count);
global_buffer[count] = '\0';
return global_buffer;


Many thanks
AnswerRe: Need some suggestions. C programming Pin
C_Zealot30-Apr-07 16:37
C_Zealot30-Apr-07 16:37 
AnswerRe: Need some suggestions. C programming Pin
David Crow30-Apr-07 17:19
David Crow30-Apr-07 17:19 
GeneralRe: Need some suggestions. C programming Pin
C_Zealot30-Apr-07 17:21
C_Zealot30-Apr-07 17:21 
QuestionNot working Pin
dellthinker30-Apr-07 12:29
dellthinker30-Apr-07 12:29 
AnswerRe: Not working [modified] Pin
Mark Salsbery30-Apr-07 13:11
Mark Salsbery30-Apr-07 13:11 
GeneralRe: Not working Pin
dellthinker1-May-07 7:07
dellthinker1-May-07 7:07 
GeneralRe: Not working Pin
Mark Salsbery1-May-07 7:15
Mark Salsbery1-May-07 7:15 
QuestionActive X Controls not working Pin
brdavid30-Apr-07 11:56
brdavid30-Apr-07 11:56 
Questionimage processing with inbuilt libraries. Pin
Evil Bluez30-Apr-07 11:46
Evil Bluez30-Apr-07 11:46 
AnswerRe: image processing with inbuilt libraries. Pin
jk chan30-Apr-07 16:09
jk chan30-Apr-07 16:09 
GeneralRe: image processing with inbuilt libraries. Pin
Evil Bluez1-May-07 11:16
Evil Bluez1-May-07 11:16 
GeneralRe: image processing with inbuilt libraries. Pin
jk chan1-May-07 14:35
jk chan1-May-07 14:35 
AnswerRe: image processing with inbuilt libraries. Pin
mt_samiei30-Apr-07 21:44
mt_samiei30-Apr-07 21:44 
Questionwhich is the difference from a unicode project and another one that is not unicode Pin
Joan M30-Apr-07 10:43
professionalJoan M30-Apr-07 10:43 
AnswerRe: which is the difference from a unicode project and another one that is not unicode Pin
Mark Salsbery30-Apr-07 12:04
Mark Salsbery30-Apr-07 12:04 
AnswerRe: which is the difference from a unicode project and another one that is not unicode Pin
Michael Dunn30-Apr-07 12:39
sitebuilderMichael Dunn30-Apr-07 12:39 
QuestionVS.Net Resource Editor issue Pin
hro_external30-Apr-07 9:18
hro_external30-Apr-07 9:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.