fscanf in inline assembly code

i have a method called readData(FILE* f, int[] x, int* arraysize)
i wanted to know how to you get data from the file ptr f and store it into the x array using inline assembly code
here is the part of code i am trying to fix

int hold;
    char format[] = "%d";
        mov  ebx,x
       mov  ecx,cursize
       mov  edx,f

      mov  dword ptr [ecx],0  ; cursize = 0
      ; call fscanf
      ; push fscanf parameters & call fscanf
        lea  ebx,hold
        push ebx
        lea  ebx,format
        push ebx      
        lea  ebx,f
        push ebx    
        call fscanf
        add  esp,12      

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Why do you need this in Assembly?

Anyway, wtite this in C and read Assembly code generated by compiler. You can see Assembly code in compiler listings, or in debugger, selecting "View Assembly" options.
majorlagAuthor Commented:
I am using Visual Studios .net 2003 to do inline assembly and i dont think or know where the "View Assembly" options is.
I need to do this in Assembly because my project is to read  a list of data from a file and put them into an array.
And the only thing I am stuck on is how to get data from the file and saving it to a register so i can copy it to the array.
I heard it is almost the same as scanf command but I tried many different ways and couldnt get it to work with fscanf.
so it would be nice if you or somebody can show me how
thank you in advance
I still don't understand - is it possible to do what you want in C? I don't see anything special in reading data from file, to do this in Assembly. Can you write this in C?

For example, create C++ Console application with the following code:

int _tmain(int argc, _TCHAR* argv[])
    int n;
    scanf("%d", &n);

    return 0;

Set breakpoint on sscanf line and select Start command. When debugger stops on this lise, select: Debug - Windows - Disassembly. You can see how scanf code is translated to Assembly by C++ compiler:

    int n;
    scanf("%d", &n);

00411B1E  lea         eax,[n]
00411B21  push        eax  
00411B22  push        offset string "%d" (4270C8h)
00411B27  call        @ILT+980(_scanf) (4113D9h)
00411B2C  add         esp,8

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
I'm puzzled as to why you want to do it in assembly - if you want to write formatted data from a file into an array, and use scanf to transform it from ascii representation to integer, for example

<code fragment, no error checking, haven't tried compiling>  :)

int myArr[10] = {0};

for ( int i = 0; i < 10; i++ )
   scanf("%d", &myArr[i]);

myArr could be a lot more complex - say a class/struct with multiple data members

 scanf("%d %d %d", &myArr[i].m_a, &myArr[i].m_b, &myArr[i].m_c);
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.