小编Bri*_*Roy的帖子

%x和〜的重要性

int m=32
printf("%x" , ~m);
Run Code Online (Sandbox Code Playgroud)

此语句的输出是ffdf和没有~输出的20.什么是意义%x~

c printf

9
推荐指数
2
解决办法
6万
查看次数

写入0xb8000000会在屏幕上产生输出而不会出现任何打印语句,例如`printf`

#include <stdio.h>
#include <conio.h>

void main()
{
  char far *v = (char far*)0xb8000000;
  clrscr();

  *v = 'w';
  v += 2;
  *v = 'e';

  getch();
}
Run Code Online (Sandbox Code Playgroud)

输出是: we

我没有得到如何在没有任何printf或其他印刷语句的情况下打印输出.

c dos

6
推荐指数
2
解决办法
1016
查看次数

如果char c = 0x80,为什么printf("%d \n",c << 1)输出-256?

#include<stdio.h>
int main(void)
{
  char c = 0x80;
  printf("%d\n", c << 1);
  return 0;
}
Run Code Online (Sandbox Code Playgroud)

-256在这种情况下输出.如果我写,c << 0那么输出是-128.

我不明白这段代码背后的逻辑.

c integer-promotion

5
推荐指数
2
解决办法
6147
查看次数

如何使用C#在ASP.NET中覆盖(不附加)文本文件

我在我的网站中包含了一个包含多行的文本文件.我在页面中放了一个文本框(Multimode = true)和一个按钮.在Page_Load上,textFile中的内容应显示在文本框中.然后用户可以编辑文本框.单击按钮时,应在该文本文件中覆盖TextBox的当前内容(不应附加).

我在文本框中成功显示了文本文件数据.但是在覆盖时,它会附加在文本文件中而不是覆盖.

这是我的代码:

protected void Page_Load(object sender, EventArgs e)
{
    if (File.Exists(Server.MapPath("newtxt.txt")))
    {
        StreamReader re = new StreamReader(Server.MapPath("newtxt.txt"));
        while ((input = re.ReadLine()) != null)
        {
           TextBox1.Text += "\r\n";
           TextBox1.Text += input;              
        }
        re.Close();
    }

    else
    {
        Response.Write("<script>alert('File does not exists')</script>");
    }       
}

protected void Button1_Click(object sender, EventArgs e)
{
    StreamWriter wr = new StreamWriter(Server.MapPath("newtxt.txt"));
    wr.Write("");
    wr.WriteLine(TextBox1.Text);
    wr.Close();
    StreamReader re = new StreamReader(Server.MapPath("newtxt.txt"));
    string input = null;
    while ((input = re.ReadLine()) != null)
    {
        TextBox1.Text += "\r\n";
        TextBox1.Text += …
Run Code Online (Sandbox Code Playgroud)

c# asp.net

4
推荐指数
2
解决办法
1万
查看次数

这个C代码背后的逻辑是什么?

for(int i=0 ; i++ ; printf("%d",i));
printf("%d",i);
Run Code Online (Sandbox Code Playgroud)

输出为1.如果我们使i = 1然后有一个荒谬的输出,如果i = -1则输出为01. For循环如何运作?

c logic

0
推荐指数
2
解决办法
558
查看次数

标签 统计

c ×4

asp.net ×1

c# ×1

dos ×1

integer-promotion ×1

logic ×1

printf ×1