Click here to Skip to main content
15,889,216 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: upload data using xmlhttp( need an urgent help) Pin
Richard MacCutchan13-Feb-13 22:25
mveRichard MacCutchan13-Feb-13 22:25 
AnswerMessage Closed Pin
14-Feb-13 0:34
Member 981141114-Feb-13 0:34 
GeneralRe: upload data using xmlhttp( need an urgent help) Pin
Richard MacCutchan14-Feb-13 0:47
mveRichard MacCutchan14-Feb-13 0:47 
GeneralMessage Closed Pin
14-Feb-13 18:33
Member 981141114-Feb-13 18:33 
GeneralRe: upload data using xmlhttp( need an urgent help) Pin
Richard MacCutchan14-Feb-13 22:52
mveRichard MacCutchan14-Feb-13 22:52 
GeneralMessage Closed Pin
15-Feb-13 18:30
Member 981141115-Feb-13 18:30 
GeneralRe: upload data using xmlhttp( need an urgent help) Pin
Richard MacCutchan15-Feb-13 22:10
mveRichard MacCutchan15-Feb-13 22:10 
QuestionReading a comma delimited file to array Pin
Jeffrey Webster13-Feb-13 14:39
Jeffrey Webster13-Feb-13 14:39 
Hi,

I'm hitting a snag as I try to read back an array which has been written to a text file. Here's the relevant part of the code:

if((fp=fopen("myfile","r"))==NULL)
 {
    printf("Unable to open file.\n");
    exit(1);
 }
  for(j=0;j<6;j++)
  {
     for(l=0;l<7;l++)
     {
        k=fgetc(fp);
         if(k==",") break;
        str2[j][l]=k;

     }
  }
   fclose(fp);
 for(j=0;j<6;j++)
 {
   for (l=0;l<7;l++)
   {
      printf("%c", str2[j][l]);
   }
 }


This is generating an error:
[Warning] comparison between pointer and integer.

Though it runs, it is revealing that the break code which checks for a comma is not functioning as the compiler warns. Why is it claiming this is a pointer? Why is it saying anything about an integer when I've deliberately cast k as a character?

Thanks for any input.
------

Update: The problem was solved by: (a) changing the double quotes to single quotes (apostrophes) and (b) switching
if(k==",") break;
below the assignment. In order to match the file derived string with one defined in code I also had to modify it:
str2[j][strlen(str2[j]-1]='\0';
as there is something foreign added in the file transfer process.
Thanks, and if there is a mark as solved button I couldn't find itSmile | :)

modified 14-Feb-13 16:08pm.

AnswerRe: Reading a comma delimited file to array Pin
Sivaraman Dhamodharan13-Feb-13 19:10
Sivaraman Dhamodharan13-Feb-13 19:10 
GeneralRe: Reading a comma delimited file to array Pin
Jeffrey Webster13-Feb-13 20:25
Jeffrey Webster13-Feb-13 20:25 
GeneralRe: Reading a comma delimited file to array Pin
Graham Breach13-Feb-13 21:33
Graham Breach13-Feb-13 21:33 
GeneralRe: Reading a comma delimited file to array Pin
Jeffrey Webster14-Feb-13 4:15
Jeffrey Webster14-Feb-13 4:15 
AnswerRe: Reading a comma delimited file to array Pin
Richard MacCutchan13-Feb-13 22:17
mveRichard MacCutchan13-Feb-13 22:17 
GeneralRe: Reading a comma delimited file to array Pin
Jeffrey Webster14-Feb-13 4:21
Jeffrey Webster14-Feb-13 4:21 
GeneralRe: Reading a comma delimited file to array Pin
Richard MacCutchan14-Feb-13 5:14
mveRichard MacCutchan14-Feb-13 5:14 
GeneralRe: Reading a comma delimited file to array Pin
Jeffrey Webster14-Feb-13 9:23
Jeffrey Webster14-Feb-13 9:23 
GeneralRe: Reading a comma delimited file to array Pin
David Crow14-Feb-13 5:14
David Crow14-Feb-13 5:14 
QuestionImplementing of Interruption Pin
mohammad torabi13-Feb-13 10:14
mohammad torabi13-Feb-13 10:14 
AnswerRe: Implementing of Interruption Pin
Albert Holguin13-Feb-13 11:49
professionalAlbert Holguin13-Feb-13 11:49 
AnswerRe: Implementing of Interruption Pin
Stefan_Lang15-Feb-13 3:39
Stefan_Lang15-Feb-13 3:39 
AnswerRe: Implementing of Interruption Pin
Shaheed Legion26-Feb-13 5:33
Shaheed Legion26-Feb-13 5:33 
QuestionLine number Add-in Pin
Krishnakumartg13-Feb-13 5:20
Krishnakumartg13-Feb-13 5:20 
QuestionRe: Line number Add-in Pin
Maximilien13-Feb-13 8:14
Maximilien13-Feb-13 8:14 
SuggestionRe: Line number Add-in Pin
Albert Holguin13-Feb-13 8:59
professionalAlbert Holguin13-Feb-13 8:59 
AnswerRe: Line number Add-in Pin
jschell13-Feb-13 10:12
jschell13-Feb-13 10:12 

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.