Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello everbody,
I know C++, so below is a code I wrote that opens/reads a file and looks for certain character and writes into another file all X and Y coordinates of a pecific character. I would like to build a matrix using VB: I need help on how to open and read a text file(read every character in file), then create a matrix and insert everyone of those characters into a table (matrix) in VB. Could anybody help with this. int main() { FILE *infile, *InkLocsFile; char line[MAXLINE]={0}; //wmapBitLoc[rows][cols] int n=0,i=0,j=0, flag=0, cl=0,Ink=0, rw = -1; infile = fopen("wmap.txt", "r"); //open fail file for reading and writing if (infile == NULL) { printf("\nError (Error opening wmap file): %s file failed to open.\n",infile); exit(0); }//end if InkLocsFile = fopen("InkLocsFile.txt", "w"); fprintf (InkLocsFile, "RowLoc ColLoc \n"); fprintf (InkLocsFile, "----- ------ \n"); while ( (fgets (line,sizeof(line),infile) != NULL)) { rw +=1; // if (strstr(line)) // { for (n=0; n<MAXLINE; n++) { if (line[n] == 48) { cl =n; fprintf (InkLocsFile, "%2d %10d \n",rw, cl); }//end if (line[n] == 0) }// end for // }//end if strstr() }//end While fclose (infile); fclose (InkLocsFile); return 0; }//end main() C++ code: |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Saving Excel files to Read/Write only folders | Excel Discussion (Misc queries) | |||
I have a read only xl file, I need it to be read and write | Excel Discussion (Misc queries) | |||
Sharing read-write Excel 2003 files | Excel Discussion (Misc queries) | |||
How can a file be converted from Read-Only to Read/Write | Excel Discussion (Misc queries) | |||
Read/Write data to/from text files from a spreadsheet. | Excel Programming |